From nobody Mon Nov 10 16:33:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@amazon.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=amazon.com ARC-Seal: i=1; a=rsa-sha256; t=1600784380; cv=none; d=zohomail.com; s=zohoarc; b=gmrMMtCFNur7FGc5sz7+bi9Zcgf1tHHBzaK4AbsXT7yUFUyvnWafjgV0XcYcb9AYE7wSXIAWgxENswNy41MeI1x6I06JAhjiz0QEj+lgpqWo55bwogC12G8Ksmw/JQ6h+OfhJZ20OQBTyTO9YwqYqn9jx0lUbLQsYuPFJqP3JWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600784380; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+nJu4gS/7OcwzlWUYMHlKyPCjt1XPzaZGoaWTe/XeyE=; b=bVnbk15zpt1HCj5a2RWIYhpevUt5SLqChCVkidhSFURlADjVdmXYsMvi5knnOI7E1dnl6ZjrRrKoVyb/wxJghi7BfbA3OPvweeydrOqI6iS81OZ1NGSsqC/LmBQOWP9sJxMkZeeRmxh3/o/Odpxe6AbmgcbhlxLQWJ4C23Erz8k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@amazon.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1600784380242803.2700402278873; Tue, 22 Sep 2020 07:19:40 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kKj8a-0003SK-VY; Tue, 22 Sep 2020 14:19:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kKj8Z-0003Ru-DJ for xen-devel@lists.xenproject.org; Tue, 22 Sep 2020 14:19:19 +0000 Received: from smtp-fw-9101.amazon.com (unknown [207.171.184.25]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 5077f38a-f0db-4e7f-b600-e79c408143a1; Tue, 22 Sep 2020 14:19:18 +0000 (UTC) Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP; 22 Sep 2020 14:16:20 +0000 Received: from EX13D31EUA004.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 4EDC11A0608; Tue, 22 Sep 2020 14:16:19 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.160.137) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 22 Sep 2020 14:16:12 +0000 X-Inumbo-ID: 5077f38a-f0db-4e7f-b600-e79c408143a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600784358; x=1632320358; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=+nJu4gS/7OcwzlWUYMHlKyPCjt1XPzaZGoaWTe/XeyE=; b=ClnVEWlQ3xQc5N2NTGk1rqLySR8uk0piGcyn/LBCX6nqzZNGwmaqt0JS VdQhNAX0itD52Zx6c7sZiTMtJRUJ1Ylc/dXwEWS0IXvMaAVvLFGo6xu5F 5fRoQzeKGrHNJxn7Shv7ZSn4gK7Xg36D0Z6yfz7f+c1r4EA0hkAXP69gw k=; X-IronPort-AV: E=Sophos;i="5.77,291,1596499200"; d="scan'208";a="70117531" From: SeongJae Park To: , , CC: SeongJae Park , , , , , , , , Subject: [PATCH v3 1/3] xen-blkback: add a parameter for disabling of persistent grants Date: Tue, 22 Sep 2020 16:15:47 +0200 Message-ID: <20200922141549.26154-2-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922141549.26154-1-sjpark@amazon.com> References: <20200922141549.26154-1-sjpark@amazon.com> MIME-Version: 1.0 X-Originating-IP: [10.43.160.137] X-ClientProxiedBy: EX13D12UWC001.ant.amazon.com (10.43.162.78) To EX13D31EUA004.ant.amazon.com (10.43.165.161) Precedence: Bulk X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @amazon.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: SeongJae Park Persistent grants feature provides high scalability. On some small systems, however, it could incur data copy overheads[1] and thus it is required to be disabled. But, there is no option to disable it. For the reason, this commit adds a module parameter for disabling of the feature. [1] https://wiki.xen.org/wiki/Xen_4.3_Block_Protocol_Scalability Signed-off-by: Anthony Liguori Signed-off-by: SeongJae Park Reviewed-by: Juergen Gross --- .../ABI/testing/sysfs-driver-xen-blkback | 9 ++++++++ drivers/block/xen-blkback/xenbus.c | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-xen-blkback b/Documenta= tion/ABI/testing/sysfs-driver-xen-blkback index ecb7942ff146..ac2947b98950 100644 --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -35,3 +35,12 @@ Description: controls the duration in milliseconds that blkback will not cache any page not backed by a grant mapping. The default is 10ms. + +What: /sys/module/xen_blkback/parameters/feature_persistent +Date: September 2020 +KernelVersion: 5.10 +Contact: SeongJae Park +Description: + Whether to enable the persistent grants feature or not. N= ote + that this option only takes effect on newly created backen= ds. + The default is Y (enable). diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback= /xenbus.c index b9aa5d1ac10b..f4c8827fa0ad 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -474,6 +474,12 @@ static void xen_vbd_free(struct xen_vbd *vbd) vbd->bdev =3D NULL; } =20 +/* Enable the persistent grants feature. */ +static bool feature_persistent =3D true; +module_param(feature_persistent, bool, 0644); +MODULE_PARM_DESC(feature_persistent, + "Enables the persistent grants feature"); + static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, unsigned major, unsigned minor, int readonly, int cdrom) @@ -519,6 +525,8 @@ static int xen_vbd_create(struct xen_blkif *blkif, blki= f_vdev_t handle, if (q && blk_queue_secure_erase(q)) vbd->discard_secure =3D true; =20 + vbd->feature_gnt_persistent =3D feature_persistent ? 1 : 0; + pr_debug("Successful creation of handle=3D%04x (dom=3D%u)\n", handle, blkif->domid); return 0; @@ -906,7 +914,8 @@ static void connect(struct backend_info *be) =20 xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); =20 - err =3D xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", 1); + err =3D xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", + be->blkif->vbd.feature_gnt_persistent); if (err) { xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", dev->nodename); @@ -1067,7 +1076,6 @@ static int connect_ring(struct backend_info *be) { struct xenbus_device *dev =3D be->dev; struct xen_blkif *blkif =3D be->blkif; - unsigned int pers_grants; char protocol[64] =3D ""; int err, i; char *xspath; @@ -1093,9 +1101,11 @@ static int connect_ring(struct backend_info *be) xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); return -ENOSYS; } - pers_grants =3D xenbus_read_unsigned(dev->otherend, "feature-persistent", - 0); - blkif->vbd.feature_gnt_persistent =3D pers_grants; + if (blkif->vbd.feature_gnt_persistent) + blkif->vbd.feature_gnt_persistent =3D + xenbus_read_unsigned(dev->otherend, + "feature-persistent", 0); + blkif->vbd.overflow_max_grants =3D 0; =20 /* @@ -1118,7 +1128,7 @@ static int connect_ring(struct backend_info *be) =20 pr_info("%s: using %d queues, protocol %d (%s) %s\n", dev->nodename, blkif->nr_rings, blkif->blk_protocol, protocol, - pers_grants ? "persistent grants" : ""); + blkif->vbd.feature_gnt_persistent ? "persistent grants" : ""); =20 ring_page_order =3D xenbus_read_unsigned(dev->otherend, "ring-page-order", 0); --=20 2.17.1