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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 9BF62C07E95 for ; Tue, 13 Jul 2021 15:50:10 +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 6BBE46023D for ; Tue, 13 Jul 2021 15:50:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BBE46023D 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=lNGyuiXLfCQV9nYbFkPfXTidDgWsfTNZc2rW+XKOQnE=; b=V4qW8FXR6vPXmT TeEq1MEg1bk6TSDM3lLU7lj8o0WRKGjZYPyNiMoGuG/my/EhKQ03LvwBOvnRnQP9kynOvV6GNtyQG vmxC4blBS1mhbEiexr7XlmQ4PPUOMzXa9odpxrCGEcYxgQyDF1/1bR9cUugF7Y6Uq882bgmhTJklv PsYPStvqjzTGFQIs8RUPJaL0NFeKv4XiGQ6OVnoDR9rS2x70IbJj5Cz0IaAlUU6mR64u1jy22r4as 9lVZsHcwhEarDv/bfu0FW3dK04hfoMuTig7wzCpSRTKWB+Ys/RdLQUubVxD/P/Yqjxcj+P86znAtd as6qea7ksf9bQ+LiNCcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3Ke7-00Aqz9-1N; Tue, 13 Jul 2021 15:48:31 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3Ke1-00Aqwr-QC for linux-arm-kernel@lists.infradead.org; Tue, 13 Jul 2021 15:48:28 +0000 Received: by mail-pl1-x62d.google.com with SMTP id n11so1797344plc.2 for ; Tue, 13 Jul 2021 08:48:25 -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=nOwfQkcUfoATzJqAE5bisD/PokYKrCYviR8WyjP18Ic=; b=IUP2Pn9R2xrjs8iHm7lcOdGOcLhhCOL7rCwupu8dwAtL9t2rkM4XJWKrJJ/daLRvWD XfdgrAx+sffHZtp/1o7u2AnnkOjET+Vs32kTTN0JbP0a9ojq3hWpXB9OQWoJ7Y02T9uJ ++1P5Ds8obO2eLfheTKugZMgh91ftTf4E3cHXhlPpYAClTmQuFaKSvDNgjOnHAIBQWI3 G27rIN1lt3yxSuYDzW8P4eNcekR/LpFuOph9Bcskpcd2KbRBU3ihS1T49svnhsDuG96+ 729GkE05pZDr8iQILLchxtUsvkYCTiOLVAvTiNRpi90cctkETvoymJRNVxVKhNzbBaUH TqSA== 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=nOwfQkcUfoATzJqAE5bisD/PokYKrCYviR8WyjP18Ic=; b=Ru17umn4ExKIzHrJjFaokF8X2oDTLMpDyXixHVBTmNhqXWvl0Q7/oO7V1a9cgmXBC+ r0PvsFZJnvFIBxypaigiTBNYw7k+1V/pwG+7hZncKlesel5jV7plgP6Ot6DV19Yb0iC9 JdyEGsZywqD6Ubboxj9JBXK2/SiReIE1rbsClK+ryLCPcXAHCSq0NJ8Tt0CmhTeXfHfp EpkcMJLrHpDp0dkYTtEGxgt8q8KDiwX0ZJgdengKtwM4EYCLjwprs00SCk5DtCyOCI2Z vadovSUpl9Xk+lcoODyDAahAlWj333CQDR8inRsfU8EirM4eHUVWVvIcorJQEzwgxA5n +tWA== X-Gm-Message-State: AOAM5303E1GsWEwbg9zVlnfjEVNHHj+bqF2yUXZG5pzzJkVY5R2+0Lw6 BO1bSXVZ3pJVE6+j1gaoMxDlAA== X-Google-Smtp-Source: ABdhPJwigp0rQLZis0JaDnZZN9nSa9J+V3Qsqnlk+GBUzYAD1Zi/QIvqfwyS+A8X8b3jUHAKI0IMdg== X-Received: by 2002:a17:90a:9484:: with SMTP id s4mr82939pjo.231.1626191304719; Tue, 13 Jul 2021 08:48:24 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([202.155.204.36]) by smtp.gmail.com with ESMTPSA id z141sm22530841pfc.146.2021.07.13.08.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 08:48:24 -0700 (PDT) Date: Tue, 13 Jul 2021 23:48:17 +0800 From: Leo Yan To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , 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 11/11] perf auxtrace: Add compat_auxtrace_mmap__{read_head|write_tail} Message-ID: <20210713154817.GE748506@leoy-ThinkPad-X240s> References: <20210711104105.505728-1-leo.yan@linaro.org> <20210711104105.505728-12-leo.yan@linaro.org> <2e4cbd2f-19b6-6fca-a8e3-86ba14247cb8@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2e4cbd2f-19b6-6fca-a8e3-86ba14247cb8@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_084825_930920_A333DCDB X-CRM114-Status: GOOD ( 22.15 ) 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 10:07:03AM +0300, Adrian Hunter wrote: [...] > > +/* > > + * In the compat mode kernel runs in 64-bit and perf tool runs in 32-bit mode, > > + * 32-bit perf tool cannot access 64-bit value atomically, which might lead to > > + * the issues caused by the below sequence on multiple CPUs: when perf tool > > + * accesses either the load operation or the store operation for 64-bit value, > > + * on some architectures the operation is divided into two instructions, one > > + * is for accessing the low 32-bit value and another is for the high 32-bit; > > + * thus these two user operations can give the kernel chances to access the > > + * 64-bit value, and thus leads to the unexpected load values. > > + * > > + * kernel (64-bit) user (32-bit) > > + * > > + * if (LOAD ->aux_tail) { --, LOAD ->aux_head_lo > > + * STORE $aux_data | ,---> > > + * FLUSH $aux_data | | LOAD ->aux_head_hi > > + * STORE ->aux_head --|-------` smp_rmb() > > + * } | LOAD $data > > + * | smp_mb() > > + * | STORE ->aux_tail_lo > > + * `-----------> > > + * STORE ->aux_tail_hi > > + * > > + * For this reason, it's impossible for the perf tool to work correctly when > > + * the AUX head or tail is bigger than 4GB (more than 32 bits length); and we > > + * can not simply limit the AUX ring buffer to less than 4GB, the reason is > > + * the pointers can be increased monotonically (e.g in snapshot mode), whatever > > At least for Intel PT, in snapshot mode, the head is always an offset > into the buffer, so never more than 4GB for a 32-bit perf tool. So maybe > leave out "(e.g in snapshot mode)" Sure, will leave out "(e.g in snapshot mode)". Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel