From mboxrd@z Thu Jan 1 00:00:00 1970 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=0.2 required=3.0 tests=BAYES_50,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 EB54CC43461 for ; Tue, 15 Sep 2020 11:30:17 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (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 6A60E20872 for ; Tue, 15 Sep 2020 11:30:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Kt+4Q+i+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A60E20872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B7E0613D9A80A; Tue, 15 Sep 2020 04:30:16 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2401:3900:2:1::2; helo=ozlabs.org; envelope-from=mpe@ellerman.id.au; receiver= Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2740713D9A808 for ; Tue, 15 Sep 2020 04:30:13 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BrLcd2lksz9sVM; Tue, 15 Sep 2020 21:30:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1600169409; bh=OQ8ZlDy64ei4/T3Jt7Yt/gqzJpjsR9iZH/wbYSEEXi4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Kt+4Q+i+95pHJ2GUXntDEfvXikdxYELoaEDu8K4QLKvBA3NlsKSvdzQ54SUoHIqVg CSXhc9s33UMWUYMFds1IRNb6TZOEq1WxKSn9Kt6XUVzPW8e2Jh8L0abkdt12A8KB3h 3T0gtjXya5WbpHRnLCNy5k2ObQjXQNjs40wJCmAQ5fH6AiZifOf2dbeSFnQpTtEQ6z DpZeuwezpM83zT9UOEhX8yJKsrQk7cUW6fFMDJe2h8OZoKzWWh57PC4IJfxHcTSTJH X/QEX9dIzv5JKDq2SB9Px4TF5RbrSlgRfm645iBnBOupNtkjBe5sUFLuVpY+AO5TU9 voPe9UbNcG0lg== From: Michael Ellerman To: Vaibhav Jain , linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org Subject: Re: [PATCH v2] powerpc/papr_scm: Fix warning triggered by perf_stats_show() In-Reply-To: <20200912081451.66225-1-vaibhav@linux.ibm.com> References: <20200912081451.66225-1-vaibhav@linux.ibm.com> Date: Tue, 15 Sep 2020 21:30:08 +1000 Message-ID: <87imcfp9a7.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Message-ID-Hash: 2N4JKG56RD3SAUBFWD3WMMQVGEVBPDJE X-Message-ID-Hash: 2N4JKG56RD3SAUBFWD3WMMQVGEVBPDJE X-MailFrom: mpe@ellerman.id.au X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: Vaibhav Jain , "Aneesh Kumar K . V" X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Vaibhav Jain writes: > A warning is reported by the kernel in case perf_stats_show() returns > an error code. The warning is of the form below: > > papr_scm ibm,persistent-memory:ibm,pmemory@44100001: > Failed to query performance stats, Err:-10 > dev_attr_show: perf_stats_show+0x0/0x1c0 [papr_scm] returned bad count > fill_read_buffer: dev_attr_show+0x0/0xb0 returned bad count > > On investigation it looks like that the compiler is silently truncating the > return value of drc_pmem_query_stats() from 'long' to 'int', since the > variable used to store the return code 'rc' is an 'int'. This > truncated value is then returned back as a 'ssize_t' back from > perf_stats_show() to 'dev_attr_show()' which thinks of it as a large > unsigned number and triggers this warning.. > > To fix this we update the type of variable 'rc' from 'int' to > 'ssize_t' that prevents the compiler from truncating the return value > of drc_pmem_query_stats() and returning correct signed value back from > perf_stats_show(). > > Fixes: 2d02bf835e573 ('powerpc/papr_scm: Fetch nvdimm performance > stats from PHYP') Please don't word wrap the Fixes tag it breaks b4. I've fixed it up this time. cheers _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 B2A5EC433E2 for ; Tue, 15 Sep 2020 11:32:59 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 CBFBC20872 for ; Tue, 15 Sep 2020 11:32:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="Kt+4Q+i+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBFBC20872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BrLgr2X2WzDqS7 for ; Tue, 15 Sep 2020 21:32:56 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BrLcf06s8zDqWR for ; Tue, 15 Sep 2020 21:30:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=Kt+4Q+i+; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BrLcd2lksz9sVM; Tue, 15 Sep 2020 21:30:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1600169409; bh=OQ8ZlDy64ei4/T3Jt7Yt/gqzJpjsR9iZH/wbYSEEXi4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Kt+4Q+i+95pHJ2GUXntDEfvXikdxYELoaEDu8K4QLKvBA3NlsKSvdzQ54SUoHIqVg CSXhc9s33UMWUYMFds1IRNb6TZOEq1WxKSn9Kt6XUVzPW8e2Jh8L0abkdt12A8KB3h 3T0gtjXya5WbpHRnLCNy5k2ObQjXQNjs40wJCmAQ5fH6AiZifOf2dbeSFnQpTtEQ6z DpZeuwezpM83zT9UOEhX8yJKsrQk7cUW6fFMDJe2h8OZoKzWWh57PC4IJfxHcTSTJH X/QEX9dIzv5JKDq2SB9Px4TF5RbrSlgRfm645iBnBOupNtkjBe5sUFLuVpY+AO5TU9 voPe9UbNcG0lg== From: Michael Ellerman To: Vaibhav Jain , linuxppc-dev@lists.ozlabs.org, linux-nvdimm@lists.01.org Subject: Re: [PATCH v2] powerpc/papr_scm: Fix warning triggered by perf_stats_show() In-Reply-To: <20200912081451.66225-1-vaibhav@linux.ibm.com> References: <20200912081451.66225-1-vaibhav@linux.ibm.com> Date: Tue, 15 Sep 2020 21:30:08 +1000 Message-ID: <87imcfp9a7.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Santosh Sivaraj , "Aneesh Kumar K . V" , Oliver O'Halloran , Vaibhav Jain , Dan Williams , Ira Weiny Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Vaibhav Jain writes: > A warning is reported by the kernel in case perf_stats_show() returns > an error code. The warning is of the form below: > > papr_scm ibm,persistent-memory:ibm,pmemory@44100001: > Failed to query performance stats, Err:-10 > dev_attr_show: perf_stats_show+0x0/0x1c0 [papr_scm] returned bad count > fill_read_buffer: dev_attr_show+0x0/0xb0 returned bad count > > On investigation it looks like that the compiler is silently truncating the > return value of drc_pmem_query_stats() from 'long' to 'int', since the > variable used to store the return code 'rc' is an 'int'. This > truncated value is then returned back as a 'ssize_t' back from > perf_stats_show() to 'dev_attr_show()' which thinks of it as a large > unsigned number and triggers this warning.. > > To fix this we update the type of variable 'rc' from 'int' to > 'ssize_t' that prevents the compiler from truncating the return value > of drc_pmem_query_stats() and returning correct signed value back from > perf_stats_show(). > > Fixes: 2d02bf835e573 ('powerpc/papr_scm: Fetch nvdimm performance > stats from PHYP') Please don't word wrap the Fixes tag it breaks b4. I've fixed it up this time. cheers