From patchwork Tue Jan 26 05:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fomichev X-Patchwork-Id: 12045291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E79C433DB for ; Tue, 26 Jan 2021 05:07:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17C1F221E7 for ; Tue, 26 Jan 2021 05:07:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17C1F221E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4GZt-0008HM-2c for qemu-devel@archiver.kernel.org; Tue, 26 Jan 2021 00:07:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4GVK-0004ar-AF; Tue, 26 Jan 2021 00:03:02 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:37779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4GVI-00071d-43; Tue, 26 Jan 2021 00:03:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1611637381; x=1643173381; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DmTUrqYYwUpxdJYIRerxbN/Gkdmpgr5jd5TqXbBcEyU=; b=nDXy51pq+SDundHy+zJFxdcHudC/e6MIgLiL9TkNVE4WLrAotUaTPnks Jc/rfAD+WiYyKkT9RCdXedxl4Ab0IlwLbK4MyPzfA5j8OH8o4Ik2PrOlp Jvb3hsBdxuLIs3mdAJzFZw/2B2l62uzVEF25r3py8kNsHTMhtqsBx6WQD xgRO0MPYyFWaCK7qTfQP+2O/szkzlfzy8sk/yWVw1SYnvk1+4GBmK5IX8 VIdnGCam54Hs6YJDmpNDGecH6qbfGEAfQizQZJoMU5bNmwevhAIfqj8FZ GqUMgWUOYkka0ZW86qrD5jEnBAKXOj2VhTAdC/oXnQDOHOR3TsIw1w0NL A==; IronPort-SDR: sJys/COk46y1BSJ7a5KMzW6NL0AhTO4G2chiNfmTFka6sMRp+OhcDJ6iTumoCvqZttyfKBFuml 3xkx2u3gHEuywgYT8QM9+MM/D2MdTa34BM6i0LwE1VOoX6V+nav6Mz8G5AymOxQCCeVvGWuO7r 4NbG2HjTvl/CjI8sZKHld7y7ekBu76xda7Y8NyTbZ28R1IdyuPhmT9Zlsp4T4bPyR29xflW1S4 1THUpwAga+nGagaxxQz8Y/b1yS1ZVCCFk1RRg/cPI7NQFfJi/jm49L2LV4a4FRklN0MjF/i8uf oOI= X-IronPort-AV: E=Sophos;i="5.79,375,1602518400"; d="scan'208";a="159493365" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jan 2021 13:03:00 +0800 IronPort-SDR: Om6iSOPGGa2uy/m2x19u2ATNPGYP1LKTmgjPNh/VL3i9oZa1325sjoRf7n3nu5K8L068mxXKdD 1lyaklCH6NxUv8VZ4VmHuLH0XXsFeyJ0L8KnixAxQZ0Mt95HyMvMKNfLBFvOgmiWWgMNT2OWMk XWjCi/D8x/h6xd4Q2aAiwjgw8k3KTXlIARJoVrj8xTYpWxBAKih8WDh5VV71j+fMhWp9NWygwM qBAkVHWmChrzCIa9QC6pXcG0SJmgErmUkUO7l3R7u6rTt3i5mTDCr13Qj7wMxl/e7dOOBgNMKn Ojs9294DKWN+2y/svn1Lgh81 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2021 20:47:26 -0800 IronPort-SDR: cKDfX0HMx+NBDLYBCBlf4J8ChoPhmB2sG8SLhp8X1onjcgKv5R7dj3m2zVWtHnDISdkuuaGvpZ WLbHhu2O6cJJtRgvnJKq63MG+xMoqUDdxigiHRjl+SQqX/QneahET/AL9OeZW+atf4hYqTfm/x 4RCMdO8kFvq/b8/3MdWhmT9o1B2wGplOP52SfT3txwwnWrpoDX2qMMAuTtjL9ScMn4fEKD0nkz ZskcF9VzJLgH/jLzn+Kn/ackMintaUfryB9ECiL/6UesPazsplXv09kBffks8bPdUhRQTMCBgm q+U= WDCIronportException: Internal Received: from unknown (HELO redsun50.ssa.fujisawa.hgst.com) ([10.149.66.24]) by uls-op-cesaip02.wdc.com with ESMTP; 25 Jan 2021 21:02:55 -0800 From: Dmitry Fomichev To: Klaus Jensen , Keith Busch , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Max Reitz , qemu-devel@nongnu.org Subject: [PATCH 3/3] hw/block/nvme: Add trace events for zone boundary violations Date: Tue, 26 Jan 2021 14:02:48 +0900 Message-Id: <20210126050248.9077-4-dmitry.fomichev@wdc.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210126050248.9077-1-dmitry.fomichev@wdc.com> References: <20210126050248.9077-1-dmitry.fomichev@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.45; envelope-from=prvs=653775e38=dmitry.fomichev@wdc.com; helo=esa6.hgst.iphmx.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_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Fomichev , Niklas Cassel , Damien Le Moal , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add three new trace events to be raised in case of zone boundary violations during Read, Write(Zeroes) and Zone Append. Signed-off-by: Dmitry Fomichev --- hw/block/nvme.c | 8 ++++++-- hw/block/trace-events | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b712634c27..4059bd72e6 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1148,6 +1148,8 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns, trace_pci_nvme_err_append_not_at_start(slba, zone->d.zslba); status = NVME_INVALID_FIELD; } else if (unlikely(zone->w_ptr + nlb > bndry)) { + trace_pci_nvme_err_append_across_boundary(slba, nlb, + zone->w_ptr, bndry); status = NVME_ZONE_BOUNDARY_ERROR; } else if (nvme_l2b(ns, nlb) > (n->page_size << n->zasl)) { trace_pci_nvme_err_append_too_large(slba, nlb, n->zasl); @@ -1159,6 +1161,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns, zone->w_ptr); status = NVME_ZONE_INVALID_WRITE; } else if (unlikely(slba + nlb > bndry)) { + trace_pci_nvme_err_write_across_boundary(slba, nlb, bndry); status = NVME_ZONE_BOUNDARY_ERROR; } } @@ -1200,9 +1203,10 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba, status = nvme_check_zone_state_for_read(zone); if (status != NVME_SUCCESS) { - ; + trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status); } else if (unlikely(end > bndry)) { if (!ns->params.cross_zone_read) { + trace_pci_nvme_err_read_across_boundary(slba, nlb, bndry); status = NVME_ZONE_BOUNDARY_ERROR; } else { /* @@ -1213,6 +1217,7 @@ static uint16_t nvme_check_zone_read(NvmeNamespace *ns, uint64_t slba, zone++; status = nvme_check_zone_state_for_read(zone); if (status != NVME_SUCCESS) { + trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status); break; } } while (end > nvme_zone_rd_boundary(ns, zone)); @@ -1624,7 +1629,6 @@ static uint16_t nvme_read(NvmeCtrl *n, NvmeRequest *req) if (ns->params.zoned) { status = nvme_check_zone_read(ns, slba, nlb); if (status != NVME_SUCCESS) { - trace_pci_nvme_err_zone_read_not_ok(slba, nlb, status); goto invalid; } } diff --git a/hw/block/trace-events b/hw/block/trace-events index 955ee4860f..18bbe560fc 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -127,6 +127,9 @@ pci_nvme_err_unaligned_zone_cmd(uint8_t action, uint64_t slba, uint64_t zslba) " pci_nvme_err_invalid_zone_state_transition(uint8_t action, uint64_t slba, uint8_t attrs) "action=0x%"PRIx8", slba=%"PRIu64", attrs=0x%"PRIx32"" pci_nvme_err_write_not_at_wp(uint64_t slba, uint64_t zone, uint64_t wp) "writing at slba=%"PRIu64", zone=%"PRIu64", but wp=%"PRIu64"" pci_nvme_err_append_not_at_start(uint64_t slba, uint64_t zone) "appending at slba=%"PRIu64", but zone=%"PRIu64"" +pci_nvme_err_append_across_boundary(uint64_t slba, uint32_t nlb, uint64_t wp, uint64_t bndry) "slba=%"PRIu64", nlb=%"PRIu32", w_ptr=%"PRIu64", bndry=%"PRIu64"" +pci_nvme_err_write_across_boundary(uint64_t slba, uint32_t nlb, uint64_t bndry) "slba=%"PRIu64", nlb=%"PRIu32", bndry=%"PRIu64"" +pci_nvme_err_read_across_boundary(uint64_t slba, uint32_t nlb, uint64_t bndry) "slba=%"PRIu64", nlb=%"PRIu32", bndry=%"PRIu64"" pci_nvme_err_zone_write_not_ok(uint64_t slba, uint32_t nlb, uint32_t status) "slba=%"PRIu64", nlb=%"PRIu32", status=0x%"PRIx16"" pci_nvme_err_zone_read_not_ok(uint64_t slba, uint32_t nlb, uint32_t status) "slba=%"PRIu64", nlb=%"PRIu32", status=0x%"PRIx16"" pci_nvme_err_append_too_large(uint64_t slba, uint32_t nlb, uint8_t zasl) "slba=%"PRIu64", nlb=%"PRIu32", zasl=%"PRIu8""