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.1 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,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 D0FE5C47083 for ; Wed, 2 Jun 2021 13:04:31 +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 9F73A6121D for ; Wed, 2 Jun 2021 13:04:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F73A6121D 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=F0I1IfS0k/uUafoRUKjzP1mIIYWq8aVzSKUtI55AwOg=; b=jHLJp04+iUkT5c z523A06tRkjG8y/Pby20RiX+WFEXu0kVSyhvsK8epr/7spFetI2/elEeixXNwzYpqdaV5FcN9oEuT NLI9bBs1w2Do/NQlYRCs9/jxJg9o4wPJjpcHFQ3UsJeozGwOMGsJO//Jj9otDCYZvVg+u1szYCuQ1 mIEc5f2t6Hxg7d5LIB+cOcVY1JqbrSyIths8t4X2LbwiZMRMjxHoGeA9IoCqNjHiKq1Gb/ftTCvhP aWC2sg24W1IKQ6boyVUZ6q7mA5RvaCxFvk/84SGA3UjC0GIF1dQcah5G5yn+fPjArUP+F76TCpuhg XH1nFifH5vuVo9hQN+Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loQVu-004DvZ-QK; Wed, 02 Jun 2021 13:02:27 +0000 Received: from mail-pf1-f181.google.com ([209.85.210.181]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loQA8-00488h-TE for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 12:40:00 +0000 Received: by mail-pf1-f181.google.com with SMTP id x73so2068466pfc.8 for ; Wed, 02 Jun 2021 05:39:55 -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=tkfGbFk7RbowFQb2pdJ2DiNSH2Hl1PMpHr94hmyAtqs=; b=lxTZN5WbWFKLKZay+tdzygwECcBcBFtb83iQAMQ8lte/ef8eggQE+S6BXoanfnJ/4I dEl0mlNV6UDIdqkQHC32HZwJ89hL6aWyh2WgB3pOoIe9D/z8kfIjRpvSZIH8pmiPlNGS IpFZWdj+7gWvUjS9SyFwBbBo8H1aSB76NwmjvgtpvFHQToHJ+Kuddzdd+0tm+VMTcgg5 7H7ew14q/bvkc2Lod182B23azGQ9B9P9FlPuvJk8Dzix8zksKnZ+vJGK2e0WeuzXv25I UkIy8wL7PVXNQ9j6HkPq9Undf92t2TZKM4M2WVAfzXaMeScb3NFjSK/mH/UmRz9bdIUs v5tg== 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=tkfGbFk7RbowFQb2pdJ2DiNSH2Hl1PMpHr94hmyAtqs=; b=ZCY4f5f23unKkjRCRm1l4SPVnfHOmRIC/gFHAkd8zHWpyUuA+NySvJOOgJ60mEsv0g pnzpT3cfijfG5G0dISBKmrBmkk8B9rc54yyTVZjPhFXmm/9HlyqV1j2izyB5KksO+BN7 qYv0HUFRf62jxWOkH1mJmAf4mPjDbX4thAhy0sSmJybzF1MV2UfiNbKFfQsnzKKw5Gc8 LIkOsNN+mXjEu8GZRMbZk6LKuQ1XiI+fzUCixjq1t3OPpjC7UZHJhV6j+jug2Sjluy8u mi0F14tmtkyJQ/25rnKIzVAA9shcdvFHs2B0WaFYukABm8i8QgJbfOmtfgEfZVg//ugR a6LQ== X-Gm-Message-State: AOAM533xRcjN97WN8P58O+XSkSlRRJwkud1rt6WmJ4GRO3axHGqeJZRe /dIZSIpkFKRN0mijSdOpblHNNw== X-Google-Smtp-Source: ABdhPJwZLYHDPPn1a+5bpf3u9GEz+y0iz9ZUQ2qJzz1MLRRwbyl6UAlRYCEn1EZr8YCrCxvzgqY3OA== X-Received: by 2002:a63:5c5d:: with SMTP id n29mr33235732pgm.131.1622637534524; Wed, 02 Jun 2021 05:38:54 -0700 (PDT) Received: from leoy-ThinkPad-X240s (ec2-18-167-84-74.ap-east-1.compute.amazonaws.com. [18.167.84.74]) by smtp.gmail.com with ESMTPSA id m2sm17340941pgu.85.2021.06.02.05.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 05:38:53 -0700 (PDT) Date: Wed, 2 Jun 2021 20:38:47 +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 , x86@kernel.org, "H. Peter Anvin" , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Andi Kleen , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 8/8] perf record: Directly bail out for compat case Message-ID: <20210602123847.GE10272@leoy-ThinkPad-X240s> References: <20210602103007.184993-1-leo.yan@linaro.org> <20210602103007.184993-9-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_053956_982393_4E0DB1C4 X-CRM114-Status: GOOD ( 21.19 ) 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 Hi Adrain, On Wed, Jun 02, 2021 at 02:18:47PM +0300, Adrian Hunter wrote: > On 2/06/21 1:30 pm, Leo Yan wrote: > > Since the 64-bit atomicity is not promised in 32-bit perf, directly > > report the error and bail out for this case. > > > > Now only applies on x86_64 and Arm64 platforms. > > > > Suggested-by: Adrian Hunter > > Maybe we can do better for the compat case. > > We can assume the upper 32-bits change very seldom, > and always increase. So for the 'read' case: > > u64 first, second, last; > u64 mask = (u64)((u32)-1) << 32; > > do { > first = READ_ONCE(pc->aux_head); > rmb(); > second = READ_ONCE(pc->aux_head); > rmb(); > last = READ_ONCE(pc->aux_head); > } while ((first & mask) != (last & mask)); > return second; > > For the write case, we can cause a fatal error only if the new > tail has non-zero upper 32-bits. That gives up to 4GiB of data > before aborting: > > if (tail & mask) > return -1; > smp_mb(); > WRITE_ONCE(pc->aux_tail, tail); Seems to me, it's pointless to only support aux_head for 64-bit and support aux_tail for 32-bit. I understand this can be helpful for the snapshot mode which only uses aux_head, but it still fails to support the normal case for AUX ring buffer using 64-bit head/tail. Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel