From patchwork Mon Sep 4 16:07:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Jagadeesh X-Patchwork-Id: 809754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="q2PmZNcs"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xmFCc31Bgz9t2Z for ; Tue, 5 Sep 2017 02:09:16 +1000 (AEST) Received: from localhost ([::1]:54735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dotw2-0007Qj-Db for incoming@patchwork.ozlabs.org; Mon, 04 Sep 2017 12:09:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dotvN-0007Ml-JD for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dotvI-0008Sg-PB for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:33 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:37002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dotvI-0008SQ-Gf for qemu-devel@nongnu.org; Mon, 04 Sep 2017 12:08:28 -0400 Received: by mail-wr0-x244.google.com with SMTP id y15so427803wrc.4 for ; Mon, 04 Sep 2017 09:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I1r1tpvzl6FUU7WmoVoNKIvgjHuTvvgLC1VwRYxmr0U=; b=q2PmZNcsTGdqvX0AGu5D9ZLRTt9IAJsEzFEvMtRy1eJKTdO4smp7KT6x+tsE8galcP +R7u8NT1+UfpQva4OlPQTF+6gogiHshmVn4wCM+8h8yMfkvqlyo0njtEwGjaXOBpac8x yHECny8akTm653wR7PyOBW6ML9dtW3S0vL+qPjsc5IBvpw092XDGb0/En2PqQzyumbri fWIjdNbcj7bBcCQEH+hFIweuApMku97PKIfB/Lx9hkhWUsjyn3t7pR2608l0EzMzXxl5 GqfZzRM5FuTuuAJffzuz8g+YueditE5drAzS7ISxYIrVKKTHcZ0lEJ/P5yiaUpzZsKLS gCeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I1r1tpvzl6FUU7WmoVoNKIvgjHuTvvgLC1VwRYxmr0U=; b=OU2VkzZlxTj2+pOnqr/3WpTaXVtFTwloG5oqhPf4KHyBsOGSJCgVHcw9iAex3HpaQC ER5dnblv1xeCXZ3C2pYSzsAwasC9Z/Cdl2qs/CeExqbZI5Hqdo0vHG4q9fFThMBRAom8 z1xx4CB+6r2JJh32/E5WP7cc8BK401fyA7hyKy6IF/NXLkFEsHZ99Eyw+YCtJJr7O2a0 Gdtv5JNnNiiSfpSWM+dthiJFsUC7s3GOeZJ6leyXiNO5/kY012yoKmZAKovRmjpzhy7l POZqz56Awv1JoI2NGhjgYhGD5UEZajXvAETyqHU846NOFZ5CmsDVEEPGek7mq1T6ZboS 85GA== X-Gm-Message-State: AHPjjUj7ut+mI3jn2UWKS1VkhSfRDN67/haEKJ9WScrJgS+ulfN9sfWw Jb1E5+313Ovwzf5I X-Google-Smtp-Source: ADKCNb4fOEPvUA/NDB9XAoURgf+AVyleiCEYnl7MLFv1jd/DXWDOWrKOSs/TfBl6JFGEA0kr0/zg7A== X-Received: by 10.223.167.154 with SMTP id j26mr589090wrc.292.1504541307544; Mon, 04 Sep 2017 09:08:27 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id x67sm976582wma.7.2017.09.04.09.08.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 09:08:26 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" Date: Mon, 4 Sep 2017 12:07:47 -0400 Message-Id: <1504541267-36954-7-git-send-email-pradeep.jagadeesh@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1504541267-36954-1-git-send-email-pradeep.jagadeesh@huawei.com> References: <1504541267-36954-1-git-send-email-pradeep.jagadeesh@huawei.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PATCH v10 6/6] fsdev: hmp interface for throttling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, jani kokkonen , alberto garcia , Pradeep Jagadeesh , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch introduces hmp interfaces for the fsdev devices. Signed-off-by: Pradeep Jagadeesh --- hmp-commands-info.hx | 18 ++++++++++++++++ hmp-commands.hx | 19 +++++++++++++++++ hmp.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hmp.h | 4 ++++ 4 files changed, 101 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index d9df238..07ed338 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -84,6 +84,24 @@ STEXI Show block device statistics. ETEXI +#if defined(CONFIG_VIRTFS) + + { + .name = "fsdev_iothrottle", + .args_type = "", + .params = "", + .help = "show fsdev iothrottle information", + .cmd = hmp_info_fsdev_iothrottle, + }, + +#endif + +STEXI +@item info fsdev_iothrottle +@findex fsdev_iothrottle +Show fsdev device throttle info. +ETEXI + { .name = "block-jobs", .args_type = "", diff --git a/hmp-commands.hx b/hmp-commands.hx index 1941e19..aef9f79 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1680,6 +1680,25 @@ STEXI Change I/O throttle limits for a block drive to @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} ETEXI +#if defined(CONFIG_VIRTFS) + + { + .name = "fsdev_set_io_throttle", + .args_type = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l", + .params = "device bps bps_rd bps_wr iops iops_rd iops_wr", + .help = "change I/O throttle limits for a fs devices", + .cmd = hmp_fsdev_set_io_throttle, + }, + +#endif + +STEXI +@item fsdev_set_io_throttle @var{device} @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} +@findex fsdev_set_io_throttle +Change I/O throttle limits for a fs devices to @var{bps} @var{bps_rd} @var{bps_wr} @var{iops} @var{iops_rd} @var{iops_wr} +ETEXI + + { .name = "set_password", .args_type = "protocol:s,password:s,connected:s?", diff --git a/hmp.c b/hmp.c index 2dbfb80..6e63cf1 100644 --- a/hmp.c +++ b/hmp.c @@ -1783,6 +1783,66 @@ void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } +#ifdef CONFIG_VIRTFS + +void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + IOThrottle throttle = { + .has_id = true, + .id = (char *) qdict_get_str(qdict, "device"), + }; + + hmp_initialize_io_throttle(&throttle, qdict); + qmp_fsdev_set_io_throttle(&throttle, &err); + hmp_handle_error(mon, &err); +} + +static void print_fsdev_throttle_config(Monitor *mon, IOThrottle *fscfg) +{ + monitor_printf(mon, "%s", fscfg->id); + monitor_printf(mon, " I/O throttling:" + " bps=%" PRId64 + " bps_rd=%" PRId64 " bps_wr=%" PRId64 + " bps_max=%" PRId64 + " bps_rd_max=%" PRId64 + " bps_wr_max=%" PRId64 + " iops=%" PRId64 " iops_rd=%" PRId64 + " iops_wr=%" PRId64 + " iops_max=%" PRId64 + " iops_rd_max=%" PRId64 + " iops_wr_max=%" PRId64 + " iops_size=%" PRId64 + "\n", + fscfg->bps, + fscfg->bps_rd, + fscfg->bps_wr, + fscfg->bps_max, + fscfg->bps_rd_max, + fscfg->bps_wr_max, + fscfg->iops, + fscfg->iops_rd, + fscfg->iops_wr, + fscfg->iops_max, + fscfg->iops_rd_max, + fscfg->iops_wr_max, + fscfg->iops_size); +} + +void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + IOThrottleList *fsdev_list, *info; + fsdev_list = qmp_query_fsdev_io_throttle(&err); + + for (info = fsdev_list; info; info = info->next) { + print_fsdev_throttle_config(mon, info->value); + } + qapi_free_IOThrottleList(fsdev_list); +} + +#endif + void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error = NULL; diff --git a/hmp.h b/hmp.h index 1ff4552..d700d7d 100644 --- a/hmp.h +++ b/hmp.h @@ -81,6 +81,10 @@ void hmp_set_password(Monitor *mon, const QDict *qdict); void hmp_expire_password(Monitor *mon, const QDict *qdict); void hmp_eject(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); +#ifdef CONFIG_VIRTFS +void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict); +void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict); +#endif void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); void hmp_block_stream(Monitor *mon, const QDict *qdict); void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);