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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 213DAC07E95 for ; Tue, 13 Jul 2021 15:49:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 010A06128E for ; Tue, 13 Jul 2021 15:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237163AbhGMPwl (ORCPT ); Tue, 13 Jul 2021 11:52:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237005AbhGMPwl (ORCPT ); Tue, 13 Jul 2021 11:52:41 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B5D5C0613E9 for ; Tue, 13 Jul 2021 08:49:51 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id v7so21995514pgl.2 for ; Tue, 13 Jul 2021 08:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xIr7FKkevos4uJS/s/2W3WMmX7MImMI8fcXTB3RkfNY=; b=ld1ysusVDnVFh7auocWjpLwv4c2/uGDwjHNxZqgOt2LPGuahJsVCZsBfzcYpirpPU4 IIQAfcolkuLX7zZ9KoQflvMbX9JK56qTDf/N9syv+ro2lYtEsEyuOHH/+M1JMijKeEcw ZrMGPiObM7dLrNbM8A+QHaiP1H7uyauZ5wYAZnXWyjNh6An7f8POLOz2FIKFZvxfKbO6 ZZL0dEBja488ed431/yduACNztDNtvu1e9fS4AxQeh7MsywlHyxGOG2xPxKIH/Hy1eR9 Mww+icrX4Xa5G02y3NbSWXdXc1LwAoal1Ipgy9brOlJE9VSiM2U9T66dOsp4ttIfGqzn TgIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xIr7FKkevos4uJS/s/2W3WMmX7MImMI8fcXTB3RkfNY=; b=US0EYQ/6Z5HiCqoBfC2vq8iRCFRrIy24UzNPGrgEb9+yPdInvsIU6MQdIv0L16aUQC 9EWufRgjanN/O2xcpCSZoDpqFYFz0VAYKR7uklDNB+Z0X4UvgAlBZyhATecPAUbwWk+h m7ftC8IbG4JUjnBot+VtV0ADVXyVGBdEJ+ILKIJBNTe81UvAtLX3h6AyKWDwivnyPUfw KuW1ee1Yd6EaWTA88+8BnXDYNT1E0Uo/zauHqhjw+yy+H4L56B2TsZl72DpSeJJeAD8G qOD9Mfg0dw1H495JpvNuMVrG7EafvmE4BFDgrL4OeQuob5Bko/t1lJZcarWtcGnIcNNT TGAw== X-Gm-Message-State: AOAM533jU4wYwhDHXoYbU4vBONFfWl8Q4jNHSTSVqGP97vrpmRpilikQ ZbWcpZ18dj5LdgFwI5/7rp9vvw== X-Google-Smtp-Source: ABdhPJzpe3HJtSU8mjK2lE1MRl7KBnXXIR52RtNoTejDMu+Emz7S0efhdZHCv0Xha2xqI10oHmWDRQ== X-Received: by 2002:a63:ed4b:: with SMTP id m11mr4987313pgk.14.1626191390733; Tue, 13 Jul 2021 08:49:50 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id a6sm17015325pjq.27.2021.07.13.08.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:49:50 -0700 (PDT) Date: Tue, 13 Jul 2021 23:49:35 +0800 From: Leo Yan To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Adrian Hunter , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 03/11] coresight: tmc-etf: Add comment for store ordering Message-ID: <20210713154935.GF748506@leoy-ThinkPad-X240s> References: <20210711104105.505728-1-leo.yan@linaro.org> <20210711104105.505728-4-leo.yan@linaro.org> <20210713125606.GB4170@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210713125606.GB4170@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 13, 2021 at 02:56:06PM +0200, Peter Zijlstra wrote: > On Sun, Jul 11, 2021 at 06:40:57PM +0800, Leo Yan wrote: > > AUX ring buffer is required to separate the data store and aux_head > > store, since the function CS_LOCK() has contained memory barrier mb(), > > mb() is a more conservative barrier than smp_wmb() on Arm32/Arm64, thus > > it's needless to add any explicit barrier anymore. > > > > Add comment to make clear for the barrier usage for ETF. > > > > Signed-off-by: Leo Yan > > --- > > drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c > > index 45b85edfc690..9a42ee689921 100644 > > --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c > > +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c > > @@ -553,6 +553,12 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, > > if (buf->snapshot) > > handle->head += to_read; > > > > + /* > > + * AUX ring buffer requires to use memory barrier to separate the trace > > + * data store and aux_head store, because CS_LOCK() contains mb() which > > + * gives more heavy barrier than smp_wmb(), it's not necessary to > > + * explicitly invoke any barrier. > > + */ > > CS_LOCK(drvdata->base); > > 'more heavy' is not a correctness argument :-) > > The argument to make here is that CS_LOCK() ensures completion / > visibility of the hardware buffer. Will correct for this, thanks for reminding! 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=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 2B23EC07E95 for ; Tue, 13 Jul 2021 15:51:39 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E02FE611AB for ; Tue, 13 Jul 2021 15:51:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E02FE611AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: 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=AJmcLoIKzNfwTU8QW1z1STOB0Oq/1gcAeHT341nRdyM=; b=nGLkzfO+vyfs6W tWZSD6q3rJKLVx7KNKFfRunFSI3+v5sAFu09U/Pa04Btw9R6bxKdGTCYoszvopVERaxDbZ5hOCMc1 EFKD2dNkM8HbreL8s4bWwg84U+58VKEWZLSf5RUSCSsCMRVNOpUcxyhDyHI7Y2e13nUV3z5ZRuRZZ nkVbp1W5LzYClkUxCAR6Oc2OPjEyinmUyLfMV0piqEca2X3yoKa7YbwMzaokFH1WcRqUUOSF5iML4 vEBbvsTZUDlKYU4moGgPb/2eVSOof32qfVafuz1EGhW0HIooB1SJGccreflW03nEB8GjLUENV2XRK kXpT21NdzZaXKgzDAALw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3KfV-00ArOb-9b; Tue, 13 Jul 2021 15:49:57 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3KfP-00ArMT-Ou for linux-arm-kernel@lists.infradead.org; Tue, 13 Jul 2021 15:49:54 +0000 Received: by mail-pf1-x42f.google.com with SMTP id p36so10301918pfw.11 for ; Tue, 13 Jul 2021 08:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xIr7FKkevos4uJS/s/2W3WMmX7MImMI8fcXTB3RkfNY=; b=ld1ysusVDnVFh7auocWjpLwv4c2/uGDwjHNxZqgOt2LPGuahJsVCZsBfzcYpirpPU4 IIQAfcolkuLX7zZ9KoQflvMbX9JK56qTDf/N9syv+ro2lYtEsEyuOHH/+M1JMijKeEcw ZrMGPiObM7dLrNbM8A+QHaiP1H7uyauZ5wYAZnXWyjNh6An7f8POLOz2FIKFZvxfKbO6 ZZL0dEBja488ed431/yduACNztDNtvu1e9fS4AxQeh7MsywlHyxGOG2xPxKIH/Hy1eR9 Mww+icrX4Xa5G02y3NbSWXdXc1LwAoal1Ipgy9brOlJE9VSiM2U9T66dOsp4ttIfGqzn TgIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xIr7FKkevos4uJS/s/2W3WMmX7MImMI8fcXTB3RkfNY=; b=jj5kFHJ0fDS+9jox9phocn3IzptTOpIkgq9TUuwmIzeYffGhvME+Nuek8XYZnTh9Rn q5EDEBLfc9HvQ2ZWsflA4OngaJ+fhquPzoTCUYZLNC0GPCYOOeay4Xioe7x+iU03FpJ/ IjXYXL+WFEWeeCyZUBJZvr7nkI6DaapZcsb7Xj7v95WEsEWEYPsYgML0G/gGe61MGb1K rHjmaB0OAyoFZLOEt5gL1F/w8jJLWM9jPPCxrbAotfJdea98KeaeMbAyKxr4jk8+aqiD IsynVJXuLzfv1X0+YSXDuLzKVqEELw4hyJXch6KiLXJXdcJfNvzKTa8XZjsc/MfP6e0c 33SQ== X-Gm-Message-State: AOAM53043t602nC2orhV5gJcuSQ/Fitduiln57znDJzGE3TPcRyGUEzU nA4mqzsALDFWZby/e3sSOTRhNw== X-Google-Smtp-Source: ABdhPJzpe3HJtSU8mjK2lE1MRl7KBnXXIR52RtNoTejDMu+Emz7S0efhdZHCv0Xha2xqI10oHmWDRQ== X-Received: by 2002:a63:ed4b:: with SMTP id m11mr4987313pgk.14.1626191390733; Tue, 13 Jul 2021 08:49:50 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id a6sm17015325pjq.27.2021.07.13.08.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:49:50 -0700 (PDT) Date: Tue, 13 Jul 2021 23:49:35 +0800 From: Leo Yan To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Adrian Hunter , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 03/11] coresight: tmc-etf: Add comment for store ordering Message-ID: <20210713154935.GF748506@leoy-ThinkPad-X240s> References: <20210711104105.505728-1-leo.yan@linaro.org> <20210711104105.505728-4-leo.yan@linaro.org> <20210713125606.GB4170@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210713125606.GB4170@worktop.programming.kicks-ass.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_084951_866620_7BC121E8 X-CRM114-Status: GOOD ( 24.07 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 13, 2021 at 02:56:06PM +0200, Peter Zijlstra wrote: > On Sun, Jul 11, 2021 at 06:40:57PM +0800, Leo Yan wrote: > > AUX ring buffer is required to separate the data store and aux_head > > store, since the function CS_LOCK() has contained memory barrier mb(), > > mb() is a more conservative barrier than smp_wmb() on Arm32/Arm64, thus > > it's needless to add any explicit barrier anymore. > > > > Add comment to make clear for the barrier usage for ETF. > > > > Signed-off-by: Leo Yan > > --- > > drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c > > index 45b85edfc690..9a42ee689921 100644 > > --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c > > +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c > > @@ -553,6 +553,12 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev, > > if (buf->snapshot) > > handle->head += to_read; > > > > + /* > > + * AUX ring buffer requires to use memory barrier to separate the trace > > + * data store and aux_head store, because CS_LOCK() contains mb() which > > + * gives more heavy barrier than smp_wmb(), it's not necessary to > > + * explicitly invoke any barrier. > > + */ > > CS_LOCK(drvdata->base); > > 'more heavy' is not a correctness argument :-) > > The argument to make here is that CS_LOCK() ensures completion / > visibility of the hardware buffer. Will correct for this, thanks for reminding! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel