From patchwork Thu Nov 10 07:05:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1702006 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=eWAVv2b+; 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=XBa3fzC9; 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 4N7CYf4Xlmz23lW for ; Thu, 10 Nov 2022 18:06:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1d5-0003ma-3T; Thu, 10 Nov 2022 02:05:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1cy-0003l5-4r; Thu, 10 Nov 2022 02:05:32 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1cv-0007L5-Ks; Thu, 10 Nov 2022 02:05:31 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CDBFE5C0153; Thu, 10 Nov 2022 02:05:28 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 10 Nov 2022 02:05:28 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063928; x= 1668150328; bh=e8xLBh7tH8Wc1gPo7Oh7iH9Lht73cQ+aSGmxuBbdcTI=; b=e WAVv2b+UujVtb+2JOkcUmiEiecly7XOgszeDwHlOvFPKYlzb44kR8U21SnqmdsDI 3BD2dLjmzynW/cbaKWL+yotv5FBfUWGHZ23OV0cr4g1+7947xe5WfUOo135fmI0X 7I484vpY5JGxHu5n1KS5b3Ux3HNzm6Ey8+ISvxkItuFhJFLm372CWroM65V7fNFe RD1X6WhR3w7UMfqA6P37aPq1A84LsbEHR3E8jaqgsqurAngbontJOLypTR5g4h7c KCJ1qoPREHwjqK6jkR+1LfeR5yDMLGiUuk9yLR+z48d2mAsrHDk1ILhhH7AOPDjk dr/9TNotlh+Rzx7ZLW4rA== 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:in-reply-to :message-id:mime-version:references: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=1668063928; x=1668150328; bh=e8xLBh7tH8Wc1 gPo7Oh7iH9Lht73cQ+aSGmxuBbdcTI=; b=XBa3fzC9SeILLWMmZY1znGv9azUpd aLc1h97zyPfih59S0Kw7KV4FSDz9xtYeZcDgiBsQaYG9bUwAFAnXYjz1x8zYCh66 yTOVUYaBSCbJcTLy9QKoN8tC3F0LXp5aEkDvGQ/mr2rL3Brtmj+qwaITOn+L9BxH TvMSGgfYSuTkOgtfComegAswzz9LNcmIWTpGcxFjWIecG222/5jiDTzJ7X9QHshT rhIl7sQPX0D9nk1P1Nj6K3/WyVFX+LHMT2Q/xkcUwVh7zXLQH6hn2DH56oOk67nF rsxZUd5G6ZiQGAzG0jI8grEY9VVMJ/zh0yHriTuCRUEpjsq8s/+wLIlZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:27 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 1/6] hw/nvme: fix accidental reintroduction of redundant code Date: Thu, 10 Nov 2022 08:05:18 +0100 Message-Id: <20221110070523.36290-2-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1171; i=k.jensen@samsung.com; h=from:subject; bh=jwGNpzW+XsmCWGaJpPPnceSGuyeYbCOK0EUA0oTQGZE=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorK3FNnpq+BsuSl728PU+FQQpQ+GDAzVHKRG a4iIC615cIkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKyAAoJEE3hrzFtTw3pO0 AH/R6vsmgPVj5XLSiRZhEq0TRcY3eQyc5JnZRTFakPH3GMgRMWx5PkT04DQJt8KsZbM8w+dNKIUGNJ wA8/a0+zuGV7HQAtOcojaIF4eA05psptSFdgdd+rV6MZDAiqYrJJzJP54PelOtkKRh0Y2j7UeWC6Pi d2TjMfW7oujyRqAymcbbCD4UkvUQfi6aFlbwui599lb8oDqPmVrLnQN5wCB2SB/13R8aobhhru29+v 1kcq/7Ynaqpmf6XP0TPfxohY8RIAOcUNqm3wqj8mC2i1EYmehByk1bYl5c+ldloUTUQVZev5JV1ceK farLHhPuGxi++xxKMQMCTkLVuXie07vrbAeqMf X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen Commit 44219b6029fc ("hw/nvme: 64-bit pi support") accidentially reintroduced code that was removed in commit a6de6ed5092c ("hw/nvme: move format parameter parsing"). It is beneign, but get rid of it anyway. Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index e23af4db91ae..918af03d32be 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5847,9 +5847,6 @@ static void nvme_format_bh(void *opaque) NvmeFormatAIOCB *iocb = opaque; NvmeRequest *req = iocb->req; NvmeCtrl *n = nvme_ctrl(req); - uint32_t dw10 = le32_to_cpu(req->cmd.cdw10); - uint8_t lbaf = dw10 & 0xf; - uint8_t pi = (dw10 >> 5) & 0x7; uint16_t status; int i; @@ -5871,7 +5868,7 @@ static void nvme_format_bh(void *opaque) goto done; } - status = nvme_format_check(iocb->ns, lbaf, pi); + status = nvme_format_check(iocb->ns, iocb->lbaf, iocb->pi); if (status) { req->status = status; goto done; From patchwork Thu Nov 10 07:05:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1702009 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=aYsq7d05; 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=D/CNVCRM; 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 4N7CZG0tPsz23lW for ; Thu, 10 Nov 2022 18:07:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1d5-0003pD-Uk; Thu, 10 Nov 2022 02:05:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1cz-0003lc-Do; Thu, 10 Nov 2022 02:05:33 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1cx-0007Qs-52; Thu, 10 Nov 2022 02:05:33 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 585AB5C01BE; Thu, 10 Nov 2022 02:05:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 10 Nov 2022 02:05:30 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063930; x= 1668150330; bh=m27MvJoRFmWAtQFcI6sig9pik+Inj8DqQ/00wBbTiws=; b=a Ysq7d05S1A68AcKrJdOAQXkUhsUSUfcnZQN9WbdCUfZuqlmWewIYMMqqX4/pykp+ yEYA1hbgYdBXhfHmdC+B+kaWN6PjpWCVVOp2/muGA7hUNeBCRdkZCvWFbMdEsje7 VUAzBywZBKjiLQxR8mV/N5UntP3KE99coN7OwFZVH8yWvCszUQ3hq426KU4gX/y7 tarYPnC9VVWXAE0pIIJ1UEtKafb/DBzWGP+4THr+O/tKdkeh7XESpKAwKvBGuBAg VUVR6JB8kSpCi4Q+kphXzYNRYeY9q96J0B5spcl1Ay3M8xuOPR/ZGeVlzRahStj2 Jnx2FNs2sog0rIsExElaQ== 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:in-reply-to :message-id:mime-version:references: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=1668063930; x=1668150330; bh=m27MvJoRFmWAt QFcI6sig9pik+Inj8DqQ/00wBbTiws=; b=D/CNVCRMrcBHaaEU8uQZdA5sSQ5Mb oXt6d3MNxCsGFc6GBaZ0YeLAjNs3a1pgeaPlu641EIjask6fimiBPFJp5qKiJJyp vn/SFKR5Vv2FBrIFETzNryqjkyKkJrqRsMnd3CxeAZZ8jR/suoxKNDkBuebqjrTS BBoE3bW7XE5/e8OBMKjHGiTLjktfVBAvEeG0ZpOT1L/k6J90bes9+kJawT1q0iR4 jyzbvqLtXt6aYYOghqqg0IAobl0N3ZA5CA13z1a+gs9ug72PiH7mKlG5IvbXzv20 QBVpsoyuPnGSO1+/xcpHuiSmSJkH8BCCUpk/7tEW0rANxcsnAQMFiSsAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:28 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 2/6] hw/nvme: fix cancellation of format operations Date: Thu, 10 Nov 2022 08:05:19 +0100 Message-Id: <20221110070523.36290-3-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=794; i=k.jensen@samsung.com; h=from:subject; bh=sIQGrip7/wT+D8iG6kE80FBYmznll9TCCzlVCVoEgvA=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorKCS8FuVAvuPC9kHui5ZjbcoGgQwEMw8vBO NJbnLe6c7YkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKyAAoJEE3hrzFtTw3ph4 QH/3oPJxwFdurEw7g5tU5bAHcdzq+z5jjSruJt7MlPd5UDYoGhDAQX2Z7HxwEumP/ZvFnuhddMusJr N7P9nM6hFXCGx/3fgy9LBvE1fHuQ2KPX2zHXoWps09afi1PbZhew9Y2hAXbJpc8EAmI2VhGog2sj0w RCdR4R04FXWXrhILpJYUx5bmQDFY42gA5Rcq9gwxrG5WvIVwzUwOZyGOAjhnK0mQ3byREDM+mM3wtp nwPupo8Nt+66D9UzWlS4lSQCxwwSirdv7OoD/glxcf6h1n3NepGsmfgIYVIZtD5U69TTxNdNA5XNdL uE9VOK8QPYN6Zf4pMzRFFocDIAi//LJK/1AKtH X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen Cancelling a format operation neglects to set iocb->ret as well as clearing the iocb->aiocb after cancelling the underlying aiocb. Fix this. Fixes: 3bcf26d3d619 ("hw/nvme: reimplement format nvm to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 918af03d32be..819c02067191 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -5762,8 +5762,11 @@ static void nvme_format_cancel(BlockAIOCB *aiocb) { NvmeFormatAIOCB *iocb = container_of(aiocb, NvmeFormatAIOCB, common); + iocb->ret = -ECANCELED; + if (iocb->aiocb) { blk_aio_cancel_async(iocb->aiocb); + iocb->aiocb = NULL; } } From patchwork Thu Nov 10 07:05:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1702007 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=bhY3lBAT; 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=FY41xgiO; 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 4N7CZ42pBsz23lW for ; Thu, 10 Nov 2022 18:06:52 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1dI-00041K-Ur; Thu, 10 Nov 2022 02:05:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1dE-0003xF-10; Thu, 10 Nov 2022 02:05:48 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1cy-0007TU-LS; Thu, 10 Nov 2022 02:05:47 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id CFA235C0136; Thu, 10 Nov 2022 02:05:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 10 Nov 2022 02:05:31 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063931; x= 1668150331; bh=BzoDTzQ23eff/L/GUm5ST5aMFbm+im6scMvm7PCp1Hs=; b=b hY3lBATMSF6xsjhPdyCxUW2IxGofy//S8uk7G5IrhboPJx6+2Yu265qpy2A2m3Tg uFw3eCXVcroWwfjuamqmbfJ11Oe02SuU41L8CCGNtdWKsvUI3jB/LbXiahCkxIG5 me/ivXZPRjPIOt8ks719MPhwbhpqs1ORx2wq2qeK6xl4HpdUsfSjyb2+WR6ELp2o /GVnWa3i7ni+r0KxmGkWF5piSWyzTXsprCUS55UXCt2luOzoSkCZBAWhI3g31iTa wt0VckBLyD7S28QzaPaciWm43IQuxYFWW71f8w69BgMviqObtYRUe12bB4p2bm1U nlhJVZYwoWt41MRw/3RsQ== 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:in-reply-to :message-id:mime-version:references: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=1668063931; x=1668150331; bh=BzoDTzQ23eff/ L/GUm5ST5aMFbm+im6scMvm7PCp1Hs=; b=FY41xgiOMmlQuVhCaI3m1OuXxdV22 dnrpO1qMC1FecO9wqihLWLIp63ZJWrfvKMGZSMIorjXdgMUGni/yf7w1chFq+mle BJVAWgc3UQ+w44bVEXd2Ze+qqk2oqOS+noV426VEkfzd2Hbgm6LVPooyUkd1FDM1 +rORuB3JwSfz9I7yOHDm/3LHlHEJ2wWIS6dBWJZspXCj6sIehxjYaHRoOJp8Qihz fZLEiMjvD/hxdU/6EBYe95g7hoc8n3f6kSeJNsxTlEtCbMDKELPfT1IGYQKl9kBu SoGCjbqO7jVnyW5YI6kWYsUOdNC8YqdpmgwRPtyTKxuvmjbq6QcfRRzog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:30 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 3/6] hw/nvme: fix flush cancel Date: Thu, 10 Nov 2022 08:05:20 +0100 Message-Id: <20221110070523.36290-4-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=579; i=k.jensen@samsung.com; h=from:subject; bh=boLQthCSkHOwADoUmz/febG+wI6yHubBYDBggyhscBU=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorO0jSg+B4Xn6MFe5ZwRpsbCwXHhgyYBQhn1 XtoocIIW84kBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKzAAoJEE3hrzFtTw3psk EIAL24LCWLSpF2FdLFUIMdnyLziqQS0JCuhaiG5q2uGXQ69BzG8qE/dUrK+gxEWMVHmSufythl0HJK zcVkqTfeQt+WodYrmZ1GIURAJwqI0jeoMKe4KUHZvQQpZJCRSZE9LqA5ZmzUHXbK8C3LHB2h8bDOvs PumPxGhNq3SCTu21s6vgAtMBbJYD6zeuclUFzivSAjr9qrQDo+si0YhpsiwijZ3tGBWliz5Iu9n7SU S0xnzyZ5FcBfm/QYZ4NmPv2TmZqfHgihP0mZwopw3wGvxatN2++3FIEphPCm0nFh6J0BFxE7T+H49d fNlx+JTC5TED1sqJ7PSpsvPmNKAXXd+rBAw6pQ X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Received-SPF: pass client-ip=66.111.4.26; envelope-from=its@irrelevant.dk; helo=out2-smtp.messagingengine.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen Make sure that iocb->aiocb is NULL'ed when cancelling. Fixes: 38f4ac65ac88 ("hw/nvme: reimplement flush to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 819c02067191..fe748fc18a2e 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -3176,6 +3176,7 @@ static void nvme_flush_cancel(BlockAIOCB *acb) if (iocb->aiocb) { blk_aio_cancel_async(iocb->aiocb); + iocb->aiocb = NULL; } } From patchwork Thu Nov 10 07:05: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: 1702011 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=dV8zyYfp; 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=wX9k3FtD; 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 4N7CZx72JXz23lW for ; Thu, 10 Nov 2022 18:07:37 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1d7-0003qB-Fu; Thu, 10 Nov 2022 02:05:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d2-0003mN-31; Thu, 10 Nov 2022 02:05:38 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d0-0007bp-7i; Thu, 10 Nov 2022 02:05:35 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 62C4C5C01BF; Thu, 10 Nov 2022 02:05:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 10 Nov 2022 02:05:33 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063933; x= 1668150333; bh=+q37KJqetTbMGxdU+/QWTLOK1xl3R4MQU0inD7AbpQM=; b=d V8zyYfpY8l7/pcf3kH0OnM/T1baHxFLZk+bu9AsJN1bRxcSMv+WZ0pq/H2Yhr7uN lRTyUljfqQIkQixim3HGRwlOuXMy1d7JXhhaxMkXUEVEjZWxV6KYWuzwNvsnsDhg bgqeBA8G13IAAA1fSgNCQHhF8xb+hZFEUsSI/7J8ZhyZLnMQqlOk+jgjiuiD80jD pYdfmQ8SsNh1hEGGkiW2PTYGv4+MXXffan60LbvGSkdRJthqsiVmbOdIA/UuSAJX QdPydYYY/YnL5993NyJpR7amgC9nl2TuCJt3GpCq9+BdoXjrFqw9d+Tt2Q6W5I8R MIOv90OFq9KjlGPm8RXeQ== 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:in-reply-to :message-id:mime-version:references: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=1668063933; x=1668150333; bh=+q37KJqetTbMG xdU+/QWTLOK1xl3R4MQU0inD7AbpQM=; b=wX9k3FtDgUwThvasZkxtd9b4Rv7Ep fG82oSztKTJRFUkm9vWRLUmnh09k0DDF1EVQ5986SyauOfa/XfWFZIoy0cwA9Vv3 eSQ1nYMe8ADvhdgJNAx836vJZpOWQb3IYKBhUXlCl72nRAiDIifv1i1m27X6o5BX ar0jBT/T6pZgmfJ/UjirUGg6Bx3bKAr0m2lVHczE/+5+Q2K8Z1a7zOQpyrXRAP4U 3WkE1LlZA2e+wr2JhY7/WKV7e1gzcNZxpeOXgrD6MPUdJmO+dl0j9IERjVo6u18V CzSQdgvceSjp5cchI6g+wn/Xic3emUlblK16mBnbZGABHDv2TY8RcseMA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:32 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 4/6] hw/nvme: fix cancellation handling in zone reset Date: Thu, 10 Nov 2022 08:05:21 +0100 Message-Id: <20221110070523.36290-5-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1746; i=k.jensen@samsung.com; h=from:subject; bh=n7Dcj1qGEyBaxhTLSaJ/sp063OE/KCgn13JRZLe8DfU=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorNwHW4m9wF91XzbKmOJp55FWQZjJos6T4e/ 3nW/12JioYkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKzAAoJEE3hrzFtTw3pqg 8H/0itizwi01O5jr9DL2bQmSyH1J8clyBx4pY2aaSEwvFC1gzgQgFg+Q/NncpsJuK3xc0d+c1Asgya BCqNsOxigFanibmvEChS+z0okqPCghyYcGkGjZGyHLQW3dGflIIs5ND8bvkD33t7YndfEh20XN60d8 LXknswxAjHB/VM0WaOxKZ68b9MLh9PoJSVGd0bL2UiZ2Q6v1QiCHL2WRb5k3O5osxWSfjaPpQmzGR6 HhT5DOt46L5J65jkuHyfiygen27mcuxSw3D+4dP+SSBH5BUhx6xupYtqw96z6HJH+0fK9cOipFwt24 VcgU7IvjFXjVVTpF4MuUzTYAbSXqAvXMwXqK2V X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen If the zone reset operation is cancelled but the block unmap operation completes normally, the callback will continue resetting the next zone since it neglects to check iocb->ret which will have been set to -ECANCELED. Make sure that this is checked and bail out if an error is present. Fixes: 63d96e4ffd71 ("hw/nvme: reimplement zone reset to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fe748fc18a2e..fa8e4b8dd53a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -3772,14 +3772,8 @@ static void nvme_zone_reset_epilogue_cb(void *opaque, int ret) int64_t moff; int count; - if (ret < 0) { - nvme_zone_reset_cb(iocb, ret); - return; - } - - if (!ns->lbaf.ms) { - nvme_zone_reset_cb(iocb, 0); - return; + if (ret < 0 || iocb->ret < 0 || !ns->lbaf.ms) { + goto out; } moff = nvme_moff(ns, iocb->zone->d.zslba); @@ -3789,6 +3783,9 @@ static void nvme_zone_reset_epilogue_cb(void *opaque, int ret) BDRV_REQ_MAY_UNMAP, nvme_zone_reset_cb, iocb); return; + +out: + nvme_zone_reset_cb(iocb, ret); } static void nvme_zone_reset_cb(void *opaque, int ret) @@ -3797,7 +3794,9 @@ static void nvme_zone_reset_cb(void *opaque, int ret) NvmeRequest *req = iocb->req; NvmeNamespace *ns = req->ns; - if (ret < 0) { + if (iocb->ret < 0) { + goto done; + } else if (ret < 0) { iocb->ret = ret; goto done; } From patchwork Thu Nov 10 07:05:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1702008 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=I7Mg1EYV; 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=SEnV4RUo; 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 4N7CZ43KzVz23mQ for ; Thu, 10 Nov 2022 18:06:52 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1d7-0003q8-Fo; Thu, 10 Nov 2022 02:05:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d3-0003mT-D2; Thu, 10 Nov 2022 02:05:38 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d1-0007fY-Ir; Thu, 10 Nov 2022 02:05:37 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C25235C0153; Thu, 10 Nov 2022 02:05:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 10 Nov 2022 02:05:34 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063934; x= 1668150334; bh=dpK/AXVrw0wKyFZ+msLjs6r4jWGMrg7IpCn1dnDY/nc=; b=I 7Mg1EYV9RpkOF7Rmk5PlyBdl94AphRwIMfGyKG+Ao/Di3Z10X1DvpZLvj6z4yYL6 x3pjeH6LwguaXsTIz3MRR9GgWlGyFsl7902z/G/XGjZq/Opezf+vf5EvhK+QdPu6 hdfHxIxfWLxWlRmqs9oQ+9Hjw3JlzNMjWTT3tw30RgOBP/R9pI+Fjryg5SjNwnns iPllLovsK2TGBfn50iWKF57sDU0YZL8upjFQVYJBL9LtWhAD3VlIIZmqhjePfpnL SApuM9deUy/tZLU2Ow7S0XSYrsmkB6WUtGlC693OtKhhvQRs2rkxVxpVRiV3Pmaz q5qjSye4hBsTb1DFEqzdw== 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:in-reply-to :message-id:mime-version:references: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=1668063934; x=1668150334; bh=dpK/AXVrw0wKy FZ+msLjs6r4jWGMrg7IpCn1dnDY/nc=; b=SEnV4RUo6DmQUGx2OnEv6DMxK5K9y gVit1mRMKCa3A7L+XGJCQN8gYirEnGbqiSDCX0ZgY1DA8VMB4O02uVeHqXV/LTdd NWEOifb5cHJizIp7RWRVxcbEt9w0gGft/kOrEtpTtucmYoAYTQSwYiUS5hOLjTQQ Ku7+KdPOk103i9pgDUGZbGUZSuTz6NZQblu1PrrLJRYO1ERWb3RugZ6Lf+MTTlh2 ODyXbxEQ/iin5H7v9BixiD4ClvY2a7bYGmTtaayo5u0MZ5esBQ3fPfCMcHBYY2oD z0BMDaU5ZLcX5NriQKBVW4+6um8XR1fzM9rJ7mZt83/fJDOVoZ3HxHrfg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:33 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 5/6] hw/nvme: fix cancellation handling in dsm Date: Thu, 10 Nov 2022 08:05:22 +0100 Message-Id: <20221110070523.36290-6-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1917; i=k.jensen@samsung.com; h=from:subject; bh=tbY5b8GPyHs2k8mhY6tLvoyX/S+S++hnbWuhpyft6XU=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorM59JsO8gn3Q3VnLIr/+XUF/JybRzgeLMvQ 9muVug12W4kBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKzAAoJEE3hrzFtTw3pAB gH/2z9NdSrQoqJQ3qcOkC4aSkgToXh1/1ypo+2xMKuqKuhxksBwEIpmj7FKdDne9ccx+Tfhe2r9ZM0 +9UXkO5badIJV0NfiwFtkPA3Wu8pMG8NzGIpdl5gRIH+cJYR4ANv3pqfFjkZdPVpNvPukklcuqxQ4F LIOFV425oPHRxqbZhgdCXVjrrIBGxZUarHOkjWHWxxavG7O/rjwTyha3MCsLupr/ZFJSq3+SSkjxGS AZzCOMR+gTplgglv/18UUveXBGT0AuO89I1vrLyS2L6B13SuQcacAhSHlDfotZJkT9EicsjNgcl/Qc M+ZjFSBsP+ImcGWoRdDVHelSWto24jkt6KA6s9 X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen When the DSM operation is cancelled asynchronously, we set iocb->ret to -ECANCELED. However, the callback function only checks the return value of the completed aio, which may have completed succesfully prior to the cancellation and thus the callback ends up continuing the dsm operation instead of bailing out. Fix this. Fixes: d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fa8e4b8dd53a..6f217c3951bd 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2384,16 +2384,10 @@ static void nvme_dsm_md_cb(void *opaque, int ret) uint64_t slba; uint32_t nlb; - if (ret < 0) { - iocb->ret = ret; + if (ret < 0 || iocb->ret < 0 || !ns->lbaf.ms) { goto done; } - if (!ns->lbaf.ms) { - nvme_dsm_cb(iocb, 0); - return; - } - range = &iocb->range[iocb->idx - 1]; slba = le64_to_cpu(range->slba); nlb = le32_to_cpu(range->nlb); @@ -2406,7 +2400,6 @@ static void nvme_dsm_md_cb(void *opaque, int ret) ret = nvme_block_status_all(ns, slba, nlb, BDRV_BLOCK_ZERO); if (ret) { if (ret < 0) { - iocb->ret = ret; goto done; } @@ -2420,8 +2413,7 @@ static void nvme_dsm_md_cb(void *opaque, int ret) return; done: - iocb->aiocb = NULL; - qemu_bh_schedule(iocb->bh); + nvme_dsm_cb(iocb, ret); } static void nvme_dsm_cb(void *opaque, int ret) @@ -2434,7 +2426,9 @@ static void nvme_dsm_cb(void *opaque, int ret) uint64_t slba; uint32_t nlb; - if (ret < 0) { + if (iocb->ret < 0) { + goto done; + } else if (ret < 0) { iocb->ret = ret; goto done; } From patchwork Thu Nov 10 07:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 1702012 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=CgEZN7/K; 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=tEpRm5lX; 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 4N7CbZ4sjJz23lW for ; Thu, 10 Nov 2022 18:08:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot1d6-0003pH-CU; Thu, 10 Nov 2022 02:05:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d4-0003mX-MU; Thu, 10 Nov 2022 02:05:38 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ot1d3-0007ng-0a; Thu, 10 Nov 2022 02:05:38 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 38DE55C01BF; Thu, 10 Nov 2022 02:05:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 10 Nov 2022 02:05:36 -0500 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:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668063936; x= 1668150336; bh=lIi2rlxIFNm5veKlUeKyLl6pPgOUP34LygI19juBMRU=; b=C gEZN7/Kczw9VgvJgzOdjFwqPMon8+NtELC7XskBrs7Xtoi43WfeBaz+ltrzA2Pkq BboaRlmzN404sy321hO+yE6+NR0EcJ8VnqHttIt0ISESxfrQGhwvrulAlpduEKiH I8Fuhk1jOmTDSdfaoNrBuYraHkvHw5Dmkj8Xm4esnjXYpTl6UXApchr0lPi0bj4d u2o+hLGCb/DiiBzAsRSY1FfgnnBPlwOqW7/+auUeoE8z95ekqRSj3Nm4eTyc1mg8 JFqS4IVexusM5/qNsvNIhAo8HPq7FN9saBz2MgpRMZvVWyHJTfHVEANg9HwoyDjX DBEx3/GIW/CT4kXZkN1sA== 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:in-reply-to :message-id:mime-version:references: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=1668063936; x=1668150336; bh=lIi2rlxIFNm5v eKlUeKyLl6pPgOUP34LygI19juBMRU=; b=tEpRm5lXjkKFIpmEXaAksaEHov5N0 0ajydTZ9rS1h5Lon+dwDpT3JSJrkikoGvwFLrJ4RXvIl/8Zqm3jx9Yo/l+JQqwz9 31bBLcoef1aG47hEPVCkKrBEWWJOPFoXQ487MDBS0dHs6G/x235+QCR4qisBidJI A4wc8F30/oBJojF8gCiFWrKuB5OR1000r+SEHi9Ds3VaJ+Y3zsnplaKurDE+8P7x +cyOBM3PZ42npgOHTgNi+J68faR8lKtzFLsdmid3ekuryQkuATQQ3u1DzbHrXlW+ tI4HtC1uDOaj/ERE/Yk+KORXP+VrmDwDWPOKmJowI5xPWKgN+LM3HWRuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfeefgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepmfhlrghu shculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrth htvghrnhepjefgieelgfeiveehkeeuveehheekfeevgeeigfehfefgjeejhefffeegudej udegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih htshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Nov 2022 02:05:34 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Klaus Jensen Subject: [PATCH for-7.2 v2 6/6] hw/nvme: fix numzrwa handling Date: Thu, 10 Nov 2022 08:05:23 +0100 Message-Id: <20221110070523.36290-7-its@irrelevant.dk> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221110070523.36290-1-its@irrelevant.dk> References: <20221110070523.36290-1-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2083; i=k.jensen@samsung.com; h=from:subject; bh=VqS4AN8VMNaJmboaDyO3t8DRKwpW38vAxFoaJjbBQxk=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGNsorPmfMppj8m/gC96bxKv7kJcVvilAtWjsuyU AsYAXoZZzYkBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJjbKKzAAoJEE3hrzFtTw3prv kH/2jyIUcLnaTddEbMi667QFz15OC1Pfempw8QoavnIRPoDkSoUnMi5AISf0/Cizs3kkJkFKUgWS1O v/u0cVnB/wvtZxx6639C0pN2z/4CDMFuVujjLPKEb0+LpsR13yCt4EoT0+0/cWs+oMa5LUgdmnrpO1 K/wZhiBcqKuaG4QZnY83eynpnAlMe/apUNwLC8t8KN8Z03AumB76dws2+yEsjQxtBAsJogF2cOKAbY DqJIl2MLS4sjfMZSD8qMvZB7JrguUAER1ztjchCYUpJZSJP871C+tnEL2ECaUvsg0g8s6a2lQrzzLU YWXOTfGJ3bVVVkuuZpnjVT/AcHSPAkavCqCK1g X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 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 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-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Klaus Jensen Number of ZRWA Resources should be initialized to Max Active Resources, and not the total number of zones. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 8 ++------ hw/nvme/ns.c | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 6f217c3951bd..b47289ecf16a 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1778,9 +1778,7 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone) if (zone->d.za & NVME_ZA_ZRWA_VALID) { zone->d.za &= ~NVME_ZA_ZRWA_VALID; - if (ns->params.numzrwa) { - ns->zns.numzrwa++; - } + ns->zns.numzrwa++; } /* fallthrough */ @@ -1820,9 +1818,7 @@ static uint16_t nvme_zrm_reset(NvmeNamespace *ns, NvmeZone *zone) nvme_aor_dec_active(ns); if (zone->d.za & NVME_ZA_ZRWA_VALID) { - if (ns->params.numzrwa) { - ns->zns.numzrwa++; - } + ns->zns.numzrwa++; } /* fallthrough */ diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 62a1f97be010..6beeacca94ea 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -286,7 +286,7 @@ static void nvme_ns_init_zoned(NvmeNamespace *ns) if (ns->params.zrwas) { ns->zns.numzrwa = ns->params.numzrwa ? - ns->params.numzrwa : ns->num_zones; + ns->params.numzrwa : ns->params.max_active_zones; ns->zns.zrwas = ns->params.zrwas >> ns->lbaf.ds; ns->zns.zrwafg = ns->params.zrwafg >> ns->lbaf.ds; @@ -294,7 +294,7 @@ static void nvme_ns_init_zoned(NvmeNamespace *ns) id_ns_z->ozcs |= NVME_ID_NS_ZONED_OZCS_ZRWASUP; id_ns_z->zrwacap = NVME_ID_NS_ZONED_ZRWACAP_EXPFLUSHSUP; - id_ns_z->numzrwa = cpu_to_le32(ns->params.numzrwa); + id_ns_z->numzrwa = cpu_to_le32(ns->zns.numzrwa - 1); id_ns_z->zrwas = cpu_to_le16(ns->zns.zrwas); id_ns_z->zrwafg = cpu_to_le16(ns->zns.zrwafg); }