Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp811638rwe; Thu, 25 Aug 2022 09:28:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR75XgyZjvu9EQBNon4NprGQfTcZHjwjk7zYEB2cBGzQp31udMu+cV4p5cfM9jJfciEScZqf X-Received: by 2002:a17:907:1c1f:b0:73d:6883:9869 with SMTP id nc31-20020a1709071c1f00b0073d68839869mr3031737ejc.241.1661444912710; Thu, 25 Aug 2022 09:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661444912; cv=none; d=google.com; s=arc-20160816; b=Kqg67/NNnBQu/JA0NNzumQ/48t9GGvmURfmFole4BKeN0SNWgXabwAnUSjmXUDf9v0 3suPYEqIeUWWmR3kRNMWM8TrnonW970tsqpOAObuutFepKQFk0JfLE7IdmTufYsrT8WY rN6lUXIxaZ+COStya4AtLFIOj4E72Wv2nG8IHleCPyj7ciqpP7Mab/qnhgt4ldzZbqQy MwkWpCd/wrPBDua6gxNufLLXlRVvRighyDAtVLxmm7eCzAOEdUGJhywJnWiAzcOM3WbB R+M/BIb6qN7I8krlOBnYiEypxSVrw9c8X6QBrwmWOYonkMxi9P/C0gBd7zBwZ3ALTi3w NRkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6FuOy2QcZ9cbF5nwC/4Sp3ef8cXbu9iZMWvEbMEu91E=; b=jywCMk7nISPYaIIlWGnAReWQp2ZGGSCKRT8lbIPYg3swmYYl+EM3kVFkC1XK1S8AFC 4k3IZe1x57ABtHs+23qdgaDg4xswJ98lMX7RltA7QB1+lk8PZRVIHczunEiKxFmFX82n e7aBJ9AeX0r7/FS1rAsboXgTyZ4iDkYYK0F9hHOn2P5qbY505Qf1Vu86huxWCUM471Ae vxCck+StuU7whQ2rCw78Dup5/kcep1qU3Qi2mLnPAKnGwXQrtR1BIsS9pUM4VB3QAZI3 9Xakya/6CMPR8L5itjXor7LUVL933IbBOBmbe0EztK7hhS2MHvZJBMPLM/L9Qx1/cYCK vSKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="A/SGhxfq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt8-20020a1709072d8800b0073daf6b44a5si4550545ejc.775.2022.08.25.09.28.06; Thu, 25 Aug 2022 09:28:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="A/SGhxfq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242941AbiHYQP2 (ORCPT + 99 others); Thu, 25 Aug 2022 12:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242973AbiHYQPZ (ORCPT ); Thu, 25 Aug 2022 12:15:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2651573A; Thu, 25 Aug 2022 09:15:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DEA3261B7C; Thu, 25 Aug 2022 16:15:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91680C433B5; Thu, 25 Aug 2022 16:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661444122; bh=u9Ghl7TkYlx4h5gPcy/Fm5vU59cOedqmjOD4pBXghVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/SGhxfqDYpB5hPxz6UxiRs26o01eLebUwupK8kC+Wfe4eXrDPazt/PWA21wO9gtm i99aqOcn854/pfR80H9iXYQd9TJlocti7VxnBsfc81u6Py04Dmh+lMaqGxsyehtr0x GaqCcykcCTIukviFErXZOEgCZdt4W2eEyGpemvdajzA3mJ6SzOoTiXC34y9H+xJiWe owqLy+vIw8Kw5hDA2FjYa98H8110kbsfwoTu2qAvzZ+xy4xgh4piRMrqq/PfNStXa7 BMSUKZTY9g4FezHMxcYcisXMN3XGWJZ2YxiNfuZ78qGaaqBL1YliAzueKZ6WgtBVpv D1Qke13oXPM5w== From: SeongJae Park To: jgross@suse.com, roger.pau@citrix.com Cc: marmarek@invisiblethingslab.com, mheyne@amazon.de, xen-devel@lists.xenproject.org, axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park , stable@vger.kernel.org Subject: [PATCH 1/2] xen-blkback: Advertise feature-persistent as user requested Date: Thu, 25 Aug 2022 16:15:10 +0000 Message-Id: <20220825161511.94922-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220825161511.94922-1-sj@kernel.org> References: <20220825161511.94922-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit e94c6101e151 ("xen-blkback: Apply 'feature_persistent' parameter when connect") made blkback to advertise its support of the persistent grants feature only if the user sets the 'feature_persistent' parameter of the driver and the frontend advertised its support of the feature. However, following commit 402c43ea6b34 ("xen-blkfront: Apply 'feature_persistent' parameter when connect") made the blkfront to work in the same way. That is, blkfront also advertises its support of the persistent grants feature only if the user sets the 'feature_persistent' parameter of the driver and the backend advertised its support of the feature. Hence blkback and blkfront will never advertise their support of the feature but wait until the other advertises the support, even though users set the 'feature_persistent' parameters of the drivers. As a result, the persistent grants feature is disabled always regardless of the 'feature_persistent' values[1]. The problem comes from the misuse of the semantic of the advertisement of the feature. The advertisement of the feature should means only availability of the feature not the decision for using the feature. However, current behavior is working in the wrong way. This commit fixes the issue by making the blkback advertises its support of the feature as user requested via 'feature_persistent' parameter regardless of the otherend's support of the feature. [1] https://lore.kernel.org/xen-devel/bd818aba-4857-bc07-dc8a-e9b2f8c5f7cd@suse.com/ Fixes: e94c6101e151 ("xen-blkback: Apply 'feature_persistent' parameter when connect") Cc: # 5.10.x Reported-by: Marek Marczykowski-Górecki Suggested-by: Juergen Gross Signed-off-by: SeongJae Park --- drivers/block/xen-blkback/common.h | 3 +++ drivers/block/xen-blkback/xenbus.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index bda5c815e441..a28473470e66 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -226,6 +226,9 @@ struct xen_vbd { sector_t size; unsigned int flush_support:1; unsigned int discard_secure:1; + /* Connect-time cached feature_persistent parameter value */ + unsigned int feature_gnt_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_gnt_persistent:1; unsigned int overflow_max_grants:1; }; diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index ee7ad2fb432d..c0227dfa4688 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -907,7 +907,7 @@ static void connect(struct backend_info *be) xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - be->blkif->vbd.feature_gnt_persistent); + be->blkif->vbd.feature_gnt_persistent_parm); if (err) { xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", dev->nodename); @@ -1085,7 +1085,9 @@ static int connect_ring(struct backend_info *be) return -ENOSYS; } - blkif->vbd.feature_gnt_persistent = feature_persistent && + blkif->vbd.feature_gnt_persistent_parm = feature_persistent; + blkif->vbd.feature_gnt_persistent = + blkif->vbd.feature_gnt_persistent_parm && xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); blkif->vbd.overflow_max_grants = 0; -- 2.25.1