From patchwork Thu Aug 25 05:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1670055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=irrelevant.dk header.i=@irrelevant.dk header.a=rsa-sha256 header.s=fm3 header.b=mmwQVzXs; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Qb9ea0na; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MCs9F6whZz1ygm for ; Thu, 25 Aug 2022 15:34:40 +1000 (AEST) Received: from localhost ([::1]:36680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR5Vk-0000dA-Hj for incoming@patchwork.ozlabs.org; Thu, 25 Aug 2022 01:34:36 -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 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 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Aug 2022 01:32:22 -0400 (EDT) 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 ret) for (bufp = buf; mbufp < end; bufp += ns->lbaf.ms, mbufp += ns->lbaf.ms) { if (memcmp(bufp + pil, mbufp + pil, ns->lbaf.ms - pil)) { - req->status = NVME_CMP_FAILURE; + req->status = NVME_CMP_FAILURE | NVME_DNR; goto out; } } @@ -2251,7 +2251,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret) } if (memcmp(buf, ctx->mdata.bounce, ctx->mdata.iov.size)) { - req->status = NVME_CMP_FAILURE; + req->status = NVME_CMP_FAILURE | NVME_DNR; goto out; } @@ -2300,7 +2300,7 @@ static void nvme_compare_data_cb(void *opaque, int ret) } if (memcmp(buf, ctx->data.bounce, ctx->data.iov.size)) { - req->status = NVME_CMP_FAILURE; + req->status = NVME_CMP_FAILURE | NVME_DNR; goto out; }