Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2679213imw; Wed, 6 Jul 2022 09:55:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vsg859vYrVoPJsGwaPGv6UujwXcXCcgWiFgy3InijgCA6n1rM1SaSURQ+HLSJPax6evE08 X-Received: by 2002:a63:610a:0:b0:412:94d2:912c with SMTP id v10-20020a63610a000000b0041294d2912cmr4083575pgb.134.1657126519396; Wed, 06 Jul 2022 09:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657126519; cv=none; d=google.com; s=arc-20160816; b=biubS4M5tXx9AKr7EzD2zIcJNWp4LfclVq3eUAkvRrqMWOtjb3qvq1lbWmJwC89h13 SzBHWMCo9ekQL4Nm56QJTdqpKNSPkkjRuXEvJkv8vM668J+9/5k5gDyBoHbbHuDRK+g5 a6W63OPTD+04mncddg2kkjGKUEu0mRFzvtJfvv2cVsN2xo8umopZgU9mLechuD7gHpQd dPRhVGC+0xtdAr5MUgAYkvpp/CIUY9T1sco0H0tooMkMEZMnmeAJZqqtRxGsq6MkVruA CJnuiMx7JJWDiY0jmUn95Ytx35PfFlHZRP3gXageLas04H+xWwbLktAJF5idT71IN2Gp gCMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/CVy8wALicTiQ5DvS+riXXmUJTzaa4wFx9X//YluBpA=; b=RT1vKJjjhkDbBJouQo21GFKhLG++c7PEnUcsoxWgOyQWyflVlkrNzIVNMI/ZsJrBnd mmmw8g4kY/MsgGNotYUybJBRfVI7MPOJ/nwqmt5+sdsAUw3KM1lfFQaFLYs7svhEgiGG Dvl6OUplDJJ11jDDpJBbNCUfwqsPq5qY9aZBd3TNZkc2XuovRJRf1Y9OiAcC4wirx6x0 tnW3Emx2AFz29kGHGF2vFoY7rU1Jn9hSyx1+lN93rsid5D2nnDhYYN735Bxs3+y/BNaz o/0gJ30HGgvE+hZp9s3tO8cMoEIy3cknk33VqYpifM4DGR2oGf6Xa08cMaDHBeHtXCyK NcNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hsAHIOUM; 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 k4-20020a170902d58400b0016c0569bfedsi1888829plh.89.2022.07.06.09.55.06; Wed, 06 Jul 2022 09:55:19 -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=hsAHIOUM; 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 S231875AbiGFQ0R (ORCPT + 99 others); Wed, 6 Jul 2022 12:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233680AbiGFQ0P (ORCPT ); Wed, 6 Jul 2022 12:26:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D7D8275D7 for ; Wed, 6 Jul 2022 09:26:14 -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 C57A661CAA for ; Wed, 6 Jul 2022 16:26:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B832C3411C; Wed, 6 Jul 2022 16:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657124773; bh=/XMuQfK+Lx5qvBfgupKs0ht8LEtOx5afaMDwU0HsGuU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hsAHIOUM1bH816MW4VoaIMkqlTjFmdAQLDxa48L3ZbcvY5OhYyJKIdbBRkGBouV8V 2XRlDzGKY6hUm4SKcKEcd3rRFiigNFUK2zczsL8EN1fP8qmUsAdKw27UT5ZBgghPXN 9rkb9zWSw6N/XN0kyLpHIY0rHPUgxpxGQTWP3Ymt8kvyySCPERpiK9KzaFHEjz6SvW OLqqEDZW0hORJ1j2P8m0aputLwgKO0J2WrOWeUDNbtI9IJUpHnM8YL8CGAtqHRWFrp 4uNqt2oqQ7LnYfm29sX8zSt0DM+LI8bviwABuDqiS23JAS7oGTDYvmvjBrzIh7GCCa HwCzsE9B9MsIQ== Date: Wed, 6 Jul 2022 10:26:09 -0600 From: Keith Busch To: Christoph Hellwig Cc: John Garry , axboe@fb.com, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvme: Fix nvme_setup_command metadata trace event for cdw10 Message-ID: References: <1657095398-114310-1-git-send-email-john.garry@huawei.com> <20220706161825.GA1962@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220706161825.GA1962@lst.de> X-Spam-Status: No, score=-7.8 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 On Wed, Jul 06, 2022 at 06:18:25PM +0200, Christoph Hellwig wrote: > On Wed, Jul 06, 2022 at 10:13:22AM -0600, Keith Busch wrote: > > Did you test what the trace looks like afte this? We're losing valuable trace > > data here. The field is supposed to get CDW's 10 - 15, so that's 24 bytes. I > > don't know why it cares that the address of the field being read is only 4 > > bytes; we want everything that comes after it too. > > Because accesses should not spawn boundaries of members in structs unless > copying the entire struct. If we want to trace the various fields we > need to individually assign them. > > Anyway, I'm dropping this patch from nvme-5.19 for now to let the > discussion conclude. How about this instead? --- diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index b5f85259461a..3c5e7fa03707 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -69,7 +69,7 @@ TRACE_EVENT(nvme_setup_cmd, __entry->metadata = !!blk_integrity_rq(req); __entry->fctype = cmd->fabrics.fctype; __assign_disk_name(__entry->disk, req->q->disk); - memcpy(__entry->cdw10, &cmd->common.cdw10, + memcpy(__entry->cdw10, &cmd->common.bytes, sizeof(__entry->cdw10)); ), TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)", diff --git a/include/linux/nvme.h b/include/linux/nvme.h index e3934003f239..1be226871763 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -906,12 +906,17 @@ struct nvme_common_command { __le32 cdw2[2]; __le64 metadata; union nvme_data_ptr dptr; - __le32 cdw10; - __le32 cdw11; - __le32 cdw12; - __le32 cdw13; - __le32 cdw14; - __le32 cdw15; + union { + struct { + __le32 cdw10; + __le32 cdw11; + __le32 cdw12; + __le32 cdw13; + __le32 cdw14; + __le32 cdw15; + }; + __u8 bytes[24]; + }; }; struct nvme_rw_command { --