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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D190FC83F25 for ; Thu, 29 Aug 2024 13:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CWtH0JL59WNhRURX48EJMx7s58aCcuQu4QycKRLAzAk=; b=pH9QYPbETcdo5nYmidGuFDALdP xoHUcBqXhEHxGPf9EKeV6CkX7vBHnNbL34IYvuuvvT6ByW1UsOJRJp6V1hT5zyFjLTtygj3mbjBsK FsXc7E4xZsx9YF3Qi5I7VQjjACiUxEK+m6BWhgZixxizfuyPLXUAGjKOp9saTt2b7XyCX095taRyO hFvB+nC9Sww2qBSsAkQBWoB3LBezrW+YUg6IKDFi2+N5XiuB9CVj2bnDDUDrz+hoCVUnlsDCfxkTk W2DYXpazuRysNYgU4LSvUjhKBwxul+kfoWiUhMzv+yWeiM3wEm69u/05RQPGXWg5auaIptLgmACM9 qZXSe/QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfSP-00000002FA6-03TP; Thu, 29 Aug 2024 13:45:01 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfPN-00000002EXb-35F8 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 13:43:21 +0000 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Wvj664XPZz6H7GS; Thu, 29 Aug 2024 21:38:22 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 658B8140A70; Thu, 29 Aug 2024 21:41:40 +0800 (CST) Received: from localhost (10.203.177.66) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 29 Aug 2024 14:41:39 +0100 Date: Thu, 29 Aug 2024 14:41:39 +0100 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , Subject: Re: [PATCH 1/3] drivers/perf: hisi_pcie: Record hardware counts correctly Message-ID: <20240829144139.0000311e@Huawei.com> In-Reply-To: <20240829090332.28756-2-yangyicong@huawei.com> References: <20240829090332.28756-1-yangyicong@huawei.com> <20240829090332.28756-2-yangyicong@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_064153_989935_2B52D269 X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 29 Aug 2024 17:03:30 +0800 Yicong Yang wrote: > From: Yicong Yang > > Currently we set the period and record it as the initial value of the > counter without checking it's set to the hardware successfully or not. > However the counter maybe unwritable if the target event is unsupported > by the device. In such case we will pass user a wrong count: > > [start counts when setting the period] > hwc->prev_count = 0x8000000000000000 > device.counter_value = 0 // the counter is not set as the period > [when user reads the counter] > event->count = device.counter_value - hwc->prev_count > = 0x8000000000000000 // wrong. should be 0. > > Fix this by record the hardware counter counts correctly when setting > the period. > > Fixes: 8404b0fbc7fb ("drivers/perf: hisi: Add driver for HiSilicon PCIe PMU") > Signed-off-by: Yicong Yang Acked-by: Jonathan Cameron