Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp850903rdb; Wed, 6 Dec 2023 01:28:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6yCN9SnA4Z3p8oKcC6oRlMLRb3MrCHay1Hn0paIyXULCq+rotpfv+sXj9177MIKtKL1+h X-Received: by 2002:a05:6358:5922:b0:16b:f950:3d83 with SMTP id g34-20020a056358592200b0016bf9503d83mr844498rwf.31.1701854920339; Wed, 06 Dec 2023 01:28:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701854920; cv=none; d=google.com; s=arc-20160816; b=WMKXscLgssGWJcnS56xzckbN0OrzsZLehYohGYllJzn8syvXfvYrnRddOu2nfJfpoH RjPCLFfQOfrtUMsgjTR+9rZ6oGi1/7VFTuUj6z6YrFiONzIEMFWY72pI3JzKpUC+77eB xSVEMgg+Om+3KzYvjVfwYLO+shUu+l4curCSnH5nNXdxNkCOYsHKslBQjaC9AcIzQBjp aDc5AJpFuIGAMbUbpKCm5pMpfnbrz1/W6qGGHLy2IFKSLDWvQ8c+w8ysxmGHHC7j/W+m gNzssDwfr56FNg0WqtmORLdlsJgFyB3vG3sDdNcD6s4hPGtV6mIqklOKSiOMFOd0ivoo n7KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=kE9MX+uF6RGYcnE6GjV6WHiGw4jiF77HmrrSmVjvfaM=; fh=hcpQStXwQSxlevAw/AYtpOLK88LTDf8XO2o8fXnmQ/8=; b=UomfenFabypBULwEX6Uy5fk3IKXW/cnzcUxHFLVHQrr1UdvPpsPHF0ZzcPhGuAPD2W /1NzrksMiM6ArH7p2m8jhGxxe7fv+BKY8TzXJSPW5Iwtmg++wORh1rG7QTpI4AZMAclU d/ClT4+xArWvm+3expuX5WbiG/Gd9S+uhLHwiM27fW9lx7MDAPAgCUSlHFGMfvMwqbBY kBakAxXW1wx1nCVDEJqI2/Cp9E8zli2x0pxsD5fgv4U8jXqCW3XSKSJtBGODa+kZpgJQ 8uy0olje0cTQXENbjOLM36e7ToJEDLmEQxJOV3b15MT25Uiy0z8Xa4RP3LAJcupOGWLY uKgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id y6-20020a056a00180600b006cd9f3d387asi2949922pfa.277.2023.12.06.01.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:28:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CFC738201B2C; Wed, 6 Dec 2023 01:28:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346769AbjLFJ2V (ORCPT + 99 others); Wed, 6 Dec 2023 04:28:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346728AbjLFJ2U (ORCPT ); Wed, 6 Dec 2023 04:28:20 -0500 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1C1FBA; Wed, 6 Dec 2023 01:28:25 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=20;SR=0;TI=SMTPD_---0VxxhQrx_1701854900; Received: from 30.25.233.235(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VxxhQrx_1701854900) by smtp.aliyun-inc.com; Wed, 06 Dec 2023 17:28:22 +0800 Message-ID: <2c092b76-6b76-4675-94c8-2e4b0031c966@linux.alibaba.com> Date: Wed, 6 Dec 2023 17:28:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 4/5] drivers/perf: add DesignWare PCIe PMU driver Content-Language: en-US To: Will Deacon , Dan Carpenter Cc: oe-kbuild@lists.linux.dev, ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, helgaas@kernel.org, yangyicong@huawei.com, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com, lkp@intel.com, oe-kbuild-all@lists.linux.dev, chengyou@linux.alibaba.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com References: <20231121013400.18367-5-xueshuai@linux.alibaba.com> <2d52f588-f584-4c01-8f41-227815a54e41@suswa.mountain> <20231205142128.GA18450@willie-the-truck> From: Shuai Xue In-Reply-To: <20231205142128.GA18450@willie-the-truck> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 01:28:37 -0800 (PST) On 2023/12/5 22:21, Will Deacon wrote: > On Sat, Nov 25, 2023 at 10:06:39AM +0300, Dan Carpenter wrote: >> Hi Shuai, >> >> kernel test robot noticed the following build warnings: >> >> https://git-scm.com/docs/git-format-patch#_base_tree_information] >> >> url: https://github.com/intel-lab-lkp/linux/commits/Shuai-Xue/docs-perf-Add-description-for-Synopsys-DesignWare-PCIe-PMU-driver/20231121-093713 >> base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next >> patch link: https://lore.kernel.org/r/20231121013400.18367-5-xueshuai%40linux.alibaba.com >> patch subject: [PATCH v11 4/5] drivers/perf: add DesignWare PCIe PMU driver >> config: x86_64-randconfig-r071-20231123 (https://download.01.org/0day-ci/archive/20231124/202311241906.0ymlLjyo-lkp@intel.com/config) >> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) >> reproduce: (https://download.01.org/0day-ci/archive/20231124/202311241906.0ymlLjyo-lkp@intel.com/reproduce) >> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of >> the same patch/commit), kindly add following tags >> | Reported-by: kernel test robot >> | Reported-by: Dan Carpenter >> | Closes: https://lore.kernel.org/r/202311241906.0ymlLjyo-lkp@intel.com/ >> >> smatch warnings: >> drivers/perf/dwc_pcie_pmu.c:352 dwc_pcie_pmu_event_update() error: uninitialized symbol 'now'. >> >> vim +/now +352 drivers/perf/dwc_pcie_pmu.c >> >> 3481798a4ec51d1 Shuai Xue 2023-11-21 338 static void dwc_pcie_pmu_event_update(struct perf_event *event) >> 3481798a4ec51d1 Shuai Xue 2023-11-21 339 { >> 3481798a4ec51d1 Shuai Xue 2023-11-21 340 struct hw_perf_event *hwc = &event->hw; >> 3481798a4ec51d1 Shuai Xue 2023-11-21 341 enum dwc_pcie_event_type type = DWC_PCIE_EVENT_TYPE(event); >> 3481798a4ec51d1 Shuai Xue 2023-11-21 342 u64 delta, prev, now; >> 3481798a4ec51d1 Shuai Xue 2023-11-21 343 >> 3481798a4ec51d1 Shuai Xue 2023-11-21 344 do { >> 3481798a4ec51d1 Shuai Xue 2023-11-21 345 prev = local64_read(&hwc->prev_count); >> 3481798a4ec51d1 Shuai Xue 2023-11-21 346 >> 3481798a4ec51d1 Shuai Xue 2023-11-21 347 if (type == DWC_PCIE_LANE_EVENT) >> 3481798a4ec51d1 Shuai Xue 2023-11-21 348 now = dwc_pcie_pmu_read_lane_event_counter(event); >> 3481798a4ec51d1 Shuai Xue 2023-11-21 349 else if (type == DWC_PCIE_TIME_BASE_EVENT) >> 3481798a4ec51d1 Shuai Xue 2023-11-21 350 now = dwc_pcie_pmu_read_time_based_counter(event); >> >> uninitialized on else path. >> >> 3481798a4ec51d1 Shuai Xue 2023-11-21 351 >> 3481798a4ec51d1 Shuai Xue 2023-11-21 @352 } while (local64_cmpxchg(&hwc->prev_count, prev, now) != prev); > > Shuai, any chance you can address this please? I think the event validation > logic means that the type is only ever one of the cases you handle, so > you probably just want to either initialise 'now' to 0 or WARN and return > early if the type is unknown. Hi, Will, and Dan, As the type is checked in dwc_pcie_pmu_event_init(), I will fix this warning by initialising 'now' to 0. Thank you. Best Regards, Shuai