From nobody Sun May 19 00:17:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1661405877083240.6790538077944; Wed, 24 Aug 2022 22:37:57 -0700 (PDT) Received: from localhost ([::1]:53586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR5Yx-0002CR-ML for importer@patchew.org; Thu, 25 Aug 2022 01:37:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR5Tn-0000bC-Qt; Thu, 25 Aug 2022 01:32:36 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:51093) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR5Tl-0007Mw-At; Thu, 25 Aug 2022 01:32:35 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D49845C00F3; Thu, 25 Aug 2022 01:32:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 25 Aug 2022 01:32:24 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Aug 2022 01:32:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm3; t=1661405544; x=1661491944; bh=Cf0CSt8Mle YP03waozQPYEC2eeSG+G8eJB+dXU/T6rE=; b=mmwQVzXs8pIFQigdmqC1yqY19p dcOAatSThDeSaAhP66i1nvmUbrYPWXTaPl0JJE/bFoOSAs/dmC+EYij3zQvC1VeE mC2VR9zwg6hCdUPFKa0Gf/edpdwK4ht+tjiipaQ3bTWWNeNi2t541dcmaO3hAT+Q 3k3QAN8tZDn+Xuu8/r7LAMdfUqCKDe2RLK7Do3X8WDyXDj0+eubmPOtry++u6h3z wbSs7ehVClrBDT+miLHpbSZqU1Oql+uHltdEex3UTTyrmZwws9lhQiF/dm0xHgV1 g5WSDp7VdkMUqD36z/kuSvMg/gRMJZ6AG+yrm2IcaNeDDYjdsYXsruXiK/LQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1661405544; x=1661491944; bh=Cf0CSt8MleYP03waozQPYEC2eeSG+G8eJB+ dXU/T6rE=; b=Qb9ea0na8W2+Yc/qppdusmoGVpkGs2YX4hQYlkDrF+VqNUnWd4z ibp1HqhjhzcBWPnZQmxzdeBEsx4N1qfkogG1rpnkY0+qVtMooWbw829/sOi8W6Sr ac5H77eBk2iSUyHWhB7hnv2EZb+ti90WlUxJJfmgsiF2VVFOOMU5SPLzMh8PE1sD esKa92MEx2yUYin9OO3fWYUbO8bFIFeA6QTp3ZD56OBtoyqTu4RCRViM64Ev5PlZ lERkRfUyw4zeTRMMiVMnOr9F5MO1s4EecJcqkbr1yAsc43D5bodzmVQCTP4yJ9MO aty4kc2j1C8wXmSM+Ex0aHxRiMTgXhEoosA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdejvddgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnheptdeludfhgeelheelledtjefffeejtdeluedvgfetveffgeetvdevkeehieeikeet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhtsh esihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Klaus Jensen , Keith Busch , Klaus Jensen , Jim Harris Subject: [PATCH] hw/nvme: set DNR on compare failure Date: Thu, 25 Aug 2022 07:32:21 +0200 Message-Id: <20220825053221.130428-1-its@irrelevant.dk> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=66.111.4.26; envelope-from=its@irrelevant.dk; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1661405878623100001 Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Even if the host is somehow using compare to do compare-and-write, the host should be notified immediately about the compare failure and not have to wait for the driver to potentially retry the command. Reported-by: Jim Harris Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 87aeba056499..299cbb1f2205 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2242,7 +2242,7 @@ static void nvme_compare_mdata_cb(void *opaque, int r= et) =20 for (bufp =3D buf; mbufp < end; bufp +=3D ns->lbaf.ms, mbufp +=3D = ns->lbaf.ms) { if (memcmp(bufp + pil, mbufp + pil, ns->lbaf.ms - pil)) { - req->status =3D NVME_CMP_FAILURE; + req->status =3D NVME_CMP_FAILURE | NVME_DNR; goto out; } } @@ -2251,7 +2251,7 @@ static void nvme_compare_mdata_cb(void *opaque, int r= et) } =20 if (memcmp(buf, ctx->mdata.bounce, ctx->mdata.iov.size)) { - req->status =3D NVME_CMP_FAILURE; + req->status =3D NVME_CMP_FAILURE | NVME_DNR; goto out; } =20 @@ -2300,7 +2300,7 @@ static void nvme_compare_data_cb(void *opaque, int re= t) } =20 if (memcmp(buf, ctx->data.bounce, ctx->data.iov.size)) { - req->status =3D NVME_CMP_FAILURE; + req->status =3D NVME_CMP_FAILURE | NVME_DNR; goto out; } =20 --=20 2.37.2