From patchwork Thu Sep 14 10:40:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pradeep Jagadeesh X-Patchwork-Id: 813768 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="jZFI9QVY"; 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 3xtFSp3s4wz9sPk for ; Thu, 14 Sep 2017 20:41:30 +1000 (AEST) Received: from localhost ([::1]:46866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsRaK-0006u1-I0 for incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 06:41:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsRZi-0006q1-19 for qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsRZg-000212-Pb for qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:50 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dsRZg-0001zr-F0 for qemu-devel@nongnu.org; Thu, 14 Sep 2017 06:40:48 -0400 Received: by mail-wm0-x242.google.com with SMTP id 187so2884675wmn.0 for ; Thu, 14 Sep 2017 03:40:48 -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=clxHdF063gSl2z+SG1HGpEXg4uKErp3vr8lBkxlZfZg=; b=jZFI9QVYbMPVQaWRqfIgsdWr23TVPfkrS1NhDObGq6GA1m4pNH3XskLyoRDaApqoX2 JpLr20yd5c6GFYqdjTntHFHncBm0F630999MgKof2gqW7MHh+U6Lx6Kef80le0qjml3e 4d7HkwhOY1T54ig945qllf4GpQPhvBESBwf2hD+FSEpyCHU/Xm+zX/ip69l72wabITzO f1bQQqhIjK6VJOTplaz+/pANnJkIUiMtbpBe2JhKzG8gsptULLR8AKz2b+2xsAasL4Ke 4TrbrNPzEwwxioOhWaDNmBiSuEDwNVfYt07fHUhKDeGwXscct1sWbfm4z7SnTlvanuVW mHYA== 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=clxHdF063gSl2z+SG1HGpEXg4uKErp3vr8lBkxlZfZg=; b=VCSaEqcgVlPf787LobkgoPPRVRpLGa7ludKbyg1nlmbTiYOMgR1di8+uJ0PbllGTz/ xrgRziOMtjBP7k7VzCIswImhgtK9JFviCpizMBI6qc7ZFZ//JBAsLphbSLiLM0r2i7RD sZud8Ek0HSpO5hbqcia+BHoEaR2y68Y0cn2u/tHL1Dv0X6uYPZrpqBY/okC1vzJLkRqZ GnwUZY2fEsAYR7BWlSoda7xocsX9DtTi7WL2fsF11gA1YSNS/bqATXwqPtI/8jlTQ3Ha 82QjXx8QuLf+RfyRBoToM8QCWHgRB8T97VM/mCMheHPDRDE1uX/Z3RnY1xPMQ+hNrcht mJTw== X-Gm-Message-State: AHPjjUiGocrIBMBWei3FNYpUachgndVm/oALNvRCNqJHjOW2MBimVs+6 O7y/EAalfq42ADnZ X-Google-Smtp-Source: AOwi7QA8fhnNT6tH/3vFVmzaGjIuu2TbbJGfYL5L65spH7agQLJXsPNRgTWGjc4ueTvw5y5nGgAvGQ== X-Received: by 10.28.111.196 with SMTP id c65mr1394118wmi.18.1505385647356; Thu, 14 Sep 2017 03:40:47 -0700 (PDT) Received: from localhost.localdomain.localdomain ([217.110.131.66]) by smtp.gmail.com with ESMTPSA id w14sm742801wmf.13.2017.09.14.03.40.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 03:40:46 -0700 (PDT) From: Pradeep Jagadeesh X-Google-Original-From: Pradeep Jagadeesh To: "eric blake" , "greg kurz" Date: Thu, 14 Sep 2017 06:40:10 -0400 Message-Id: <1505385610-35529-7-git-send-email-pradeep.jagadeesh@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1505385610-35529-1-git-send-email-pradeep.jagadeesh@huawei.com> References: <1505385610-35529-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:c09::242 Subject: [Qemu-devel] [PATCH v11 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 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Alberto Garcia --- hmp-commands-info.hx | 18 ++++++++++++++++ hmp-commands.hx | 19 +++++++++++++++++ hmp.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ hmp.h | 4 ++++ 4 files changed, 100 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 4ab7fce..54f1968 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 acaf0e6..ceec6c9 100644 --- a/hmp.c +++ b/hmp.c @@ -1778,6 +1778,65 @@ 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; + ThrottleLimits throttle = { + .has_id = true, + .id = (char *) qdict_get_str(qdict, "device"), + }; + + hmp_initialize_throttle_limits(&throttle, qdict); + qmp_fsdev_set_io_throttle(&throttle, &err); + hmp_handle_error(mon, &err); +} + +static void print_fsdev_throttle_config(Monitor *mon, ThrottleLimits *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_total, + fscfg->bps_read, + fscfg->bps_write, + fscfg->bps_total_max, + fscfg->bps_read_max, + fscfg->bps_write_max, + fscfg->iops_total, + fscfg->iops_read, + fscfg->iops_write, + fscfg->iops_total_max, + fscfg->iops_read_max, + fscfg->iops_write_max, + fscfg->iops_size); +} + +void hmp_info_fsdev_iothrottle(Monitor *mon, const QDict *qdict) +{ + ThrottleLimitsList *fsdev_list, *info; + fsdev_list = qmp_query_fsdev_io_throttle(NULL); + + for (info = fsdev_list; info; info = info->next) { + print_fsdev_throttle_config(mon, info->value); + } + qapi_free_ThrottleLimitsList(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);