Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp29930lqb; Thu, 14 Mar 2024 04:48:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPZdICjnB/PdC7rXq5MGl5h69YbszHwY9HWHT4PopWffxmEblgUd4xp7B+J8951YTFOX1Ph6YkYdtHq+FoalsYOwPzB0N8q8EP5BHPFA== X-Google-Smtp-Source: AGHT+IGd5Dv+b3UwMZDpGGxSBk3Z2P+Pvw/vwV5J0HE/NSAl42fQ80YQSr0gH2qc3FzIwIWUN1tV X-Received: by 2002:a05:6214:5292:b0:691:633b:729a with SMTP id kj18-20020a056214529200b00691633b729amr28295qvb.42.1710416938192; Thu, 14 Mar 2024 04:48:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710416938; cv=pass; d=google.com; s=arc-20160816; b=rjYcvBW2rTfbjaH8R45cdAHbyNgsve/taI972mWhBZjSTtri0+M5487Cwa4Ry55AKt pzh+GE1gRmm9ehtVy31hJrCHiigYrqeM6IC12SDNq+Y+5sHxUsG8mJUywOYnhx320dpl BOQNavw9jDiITozs+P0K1iDuMamlOcLM/ALQ5fAUgWvV2HrpIOisqX4Hyh1z8Rylt+FZ xLYOM8sbLWHTP3yeGdkjwrUt/KrqgC5l/xpOmM+w3J58bByE6ZStxuFgv5mMyNCIShxu 1ATFMbjtSSEegdChygTAq/pIisv9B975qDfQKUCjZJJCjg7BDrH+POMkG0uuULi8Zfvb dqdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to:subject:cc :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=0A/JntU0DofMW+Q2e2Zg/xjrZN5mfseEodt+zCBazlk=; fh=ghisn5U+HLVWK+0Fbmio8WjJq9BBzW6/4z4WCD/o+OI=; b=JX2p0qQ0Sd9BfQSh17gw0Mq1L+5394wPNgTcQNhx3RdXKwglkD5Xy7KF8223VL8j40 GBPiG9hCU6S0gYeceZsabC2BhePWPF89887rmsCfx9Ovu5W2XxxmCkAfWT0ThfNiNw/K EXSZ6RwqMRJWOFPpzui+HyJoll53g6aoTzje/k+1T+3ikGYcLjUyns2OyaLjfGcsGjhR 56MiBbiiOlDC2tZFJfwakamomJ7kix8NKAHX9pD3bpKTQjGrLnOtlbNsD1imUnPw73He qp8PCEfJXPcY4S0nIua0xjoIuq2XyRYj8o8++VsCaS0U8CmpeGcs3M2SfZnyhtWbWkjY jIFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-103195-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id mf12-20020a0562145d8c00b006915bf170d8si394801qvb.446.2024.03.14.04.48.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 04:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103195-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-103195-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D988F1C20ED7 for ; Thu, 14 Mar 2024 11:48:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22AA76F071; Thu, 14 Mar 2024 11:48:48 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DC146EB6D; Thu, 14 Mar 2024 11:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710416927; cv=none; b=mEZAOY4V58FKAm3sUNz1AjhK6SD63nWe6ROfvx6QvZZIH7K+5Wsydry/c7i3/VQWv1iBEj+8cfr73AInzTlQtHymNz2NtRCFh2eXrz3mpTRD5vSv/Z+SfLV+SzDl7PuIP1ES2kngAgCLil0/p5+YiWXK2jgT7xyFRTXEhPzu6a4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710416927; c=relaxed/simple; bh=7ZiBPpdN/pRir9iGW2WDn9wd7ox5+ZWpl5rz4L8hPpM=; h=Message-ID:Date:MIME-Version:CC:Subject:To:References:From: In-Reply-To:Content-Type; b=HhNVcJuuK4QcruPysEGwnrJxJkIO/bEKUCZ1/pofYyJymEBZm9D2Lh05xnK8PI15L/wsu2M6JSUywL7LWgpMYo8rYmuJtnwARXZzIuEda8EQv0pV+QZjrvh8J2rqOaL3/quEghVIWK749GaaVJxj7IiWNAw4zRCE6RxeFhgdIrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TwQb24vv0z1xrD5; Thu, 14 Mar 2024 19:46:54 +0800 (CST) Received: from kwepemm600007.china.huawei.com (unknown [7.193.23.208]) by mail.maildlp.com (Postfix) with ESMTPS id 18715180061; Thu, 14 Mar 2024 19:48:41 +0800 (CST) Received: from [10.67.120.192] (10.67.120.192) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 14 Mar 2024 19:48:40 +0800 Message-ID: Date: Thu, 14 Mar 2024 19:48:39 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yufeng Mo , Huazhong Tan Subject: Re: [PATCH] net: hns3: tracing: fix hclgevf trace event strings To: Steven Rostedt , LKML , Linux Trace Kernel , netdev References: <20240313093454.3909afe7@gandalf.local.home> From: Jijie Shao In-Reply-To: <20240313093454.3909afe7@gandalf.local.home> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600007.china.huawei.com (7.193.23.208) Reviewed-by: Jijie Shao on 2024/3/13 21:34, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > [ > Note, I need to take this patch through my tree, so I'm looking for acks. > This causes the build to fail when I add the __assign_str() check, which > I was about to push to Linus, but it breaks allmodconfig due to this error. > ] > > The __string() and __assign_str() helper macros of the TRACE_EVENT() macro > are going through some optimizations where only the source string of > __string() will be used and the __assign_str() source will be ignored and > later removed. > > To make sure that there's no issues, a new check is added between the > __string() src argument and the __assign_str() src argument that does a > strcmp() to make sure they are the same string. > > The hclgevf trace events have: > > __assign_str(devname, &hdev->nic.kinfo.netdev->name); > > Which triggers the warning: > > hclgevf_trace.h:34:39: error: passing argument 1 of ‘strcmp’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 34 | __assign_str(devname, &hdev->nic.kinfo.netdev->name); > [..] > arch/x86/include/asm/string_64.h:75:24: note: expected ‘const char *’ but argument is of type ‘char (*)[16]’ > 75 | int strcmp(const char *cs, const char *ct); > | ~~~~~~~~~~~~^~ > > > Because __assign_str() now has: > > WARN_ON_ONCE(__builtin_constant_p(src) ? \ > strcmp((src), __data_offsets.dst##_ptr_) : \ > (src) != __data_offsets.dst##_ptr_); \ > > The problem is the '&' on hdev->nic.kinfo.netdev->name. That's because > that name is: > > char name[IFNAMSIZ] > > Where passing an address '&' of a char array is not compatible with strcmp(). > > The '&' is not necessary, remove it. > > Fixes: d8355240cf8fb ("net: hns3: add trace event support for PF/VF mailbox") > Signed-off-by: Steven Rostedt (Google) > --- > drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h | 8 ++++---- > .../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h | 8 ++++---- > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h > index 8510b88d4982..f3cd5a376eca 100644 > --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_trace.h > @@ -24,7 +24,7 @@ TRACE_EVENT(hclge_pf_mbx_get, > __field(u8, code) > __field(u8, subcode) > __string(pciname, pci_name(hdev->pdev)) > - __string(devname, &hdev->vport[0].nic.kinfo.netdev->name) > + __string(devname, hdev->vport[0].nic.kinfo.netdev->name) > __array(u32, mbx_data, PF_GET_MBX_LEN) > ), > > @@ -33,7 +33,7 @@ TRACE_EVENT(hclge_pf_mbx_get, > __entry->code = req->msg.code; > __entry->subcode = req->msg.subcode; > __assign_str(pciname, pci_name(hdev->pdev)); > - __assign_str(devname, &hdev->vport[0].nic.kinfo.netdev->name); > + __assign_str(devname, hdev->vport[0].nic.kinfo.netdev->name); > memcpy(__entry->mbx_data, req, > sizeof(struct hclge_mbx_vf_to_pf_cmd)); > ), > @@ -56,7 +56,7 @@ TRACE_EVENT(hclge_pf_mbx_send, > __field(u8, vfid) > __field(u16, code) > __string(pciname, pci_name(hdev->pdev)) > - __string(devname, &hdev->vport[0].nic.kinfo.netdev->name) > + __string(devname, hdev->vport[0].nic.kinfo.netdev->name) > __array(u32, mbx_data, PF_SEND_MBX_LEN) > ), > > @@ -64,7 +64,7 @@ TRACE_EVENT(hclge_pf_mbx_send, > __entry->vfid = req->dest_vfid; > __entry->code = le16_to_cpu(req->msg.code); > __assign_str(pciname, pci_name(hdev->pdev)); > - __assign_str(devname, &hdev->vport[0].nic.kinfo.netdev->name); > + __assign_str(devname, hdev->vport[0].nic.kinfo.netdev->name); > memcpy(__entry->mbx_data, req, > sizeof(struct hclge_mbx_pf_to_vf_cmd)); > ), > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h > index 5d4895bb57a1..b259e95dd53c 100644 > --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_trace.h > @@ -23,7 +23,7 @@ TRACE_EVENT(hclge_vf_mbx_get, > __field(u8, vfid) > __field(u16, code) > __string(pciname, pci_name(hdev->pdev)) > - __string(devname, &hdev->nic.kinfo.netdev->name) > + __string(devname, hdev->nic.kinfo.netdev->name) > __array(u32, mbx_data, VF_GET_MBX_LEN) > ), > > @@ -31,7 +31,7 @@ TRACE_EVENT(hclge_vf_mbx_get, > __entry->vfid = req->dest_vfid; > __entry->code = le16_to_cpu(req->msg.code); > __assign_str(pciname, pci_name(hdev->pdev)); > - __assign_str(devname, &hdev->nic.kinfo.netdev->name); > + __assign_str(devname, hdev->nic.kinfo.netdev->name); > memcpy(__entry->mbx_data, req, > sizeof(struct hclge_mbx_pf_to_vf_cmd)); > ), > @@ -55,7 +55,7 @@ TRACE_EVENT(hclge_vf_mbx_send, > __field(u8, code) > __field(u8, subcode) > __string(pciname, pci_name(hdev->pdev)) > - __string(devname, &hdev->nic.kinfo.netdev->name) > + __string(devname, hdev->nic.kinfo.netdev->name) > __array(u32, mbx_data, VF_SEND_MBX_LEN) > ), > > @@ -64,7 +64,7 @@ TRACE_EVENT(hclge_vf_mbx_send, > __entry->code = req->msg.code; > __entry->subcode = req->msg.subcode; > __assign_str(pciname, pci_name(hdev->pdev)); > - __assign_str(devname, &hdev->nic.kinfo.netdev->name); > + __assign_str(devname, hdev->nic.kinfo.netdev->name); > memcpy(__entry->mbx_data, req, > sizeof(struct hclge_mbx_vf_to_pf_cmd)); > ),