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,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 54B4FC4338F for ; Tue, 24 Aug 2021 02:16:30 +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 0EB2C60E8B for ; Tue, 24 Aug 2021 02:16:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0EB2C60E8B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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=PnUFg68qesfTz0MgU+0rflDQvydDxSqz+ghz5yHp0o8=; b=uc5Gb4+0J+tZ7D libcSJMpTI8ZLdf+ZCeoQ5TZClgMUmk33OoievxfI6qlCcrmTZ4nD61tvz2N4MnP90Y8HSR93G7ET si+ByBwKmWUoIXPDEMXcdV2mdcV8XXF4OtrfZWNhWdqwPovXswmVvl7B1lk6f1Qfa9Plxp8UAXNAs O7sEfJoY8jZTRd/xfIN4nTUhjBJBMj4bxqGjj6QE37lmysNnjGZmuRbMUIUZnwOPH6RtBhGN9o6sV Hhd7gQjFGz15D3IDwuzo7W8LXDa2WQEb9IKeklTZon7FXkBgVs5VuDhMB3T7vD8PeaZdRj0F0L2gU Z+2O2wErzOsUaFvFYSQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mILwW-001EMN-A4; Tue, 24 Aug 2021 02:13:36 +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 1mILwQ-001EL0-Vd for linux-arm-kernel@lists.infradead.org; Tue, 24 Aug 2021 02:13:34 +0000 Received: by mail-pl1-x62d.google.com with SMTP id x15so1882749plg.10 for ; Mon, 23 Aug 2021 19:13:28 -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=hTyHyLQYzEOA4uGWERB+WxPgnaDFfEzDVJ9NEcQymOA=; b=ravVzzjn1uN3ecrzUOIwEmyxWBG0Bqlfl4gAtOHZjf+4xRiy2kVXIMcyFiaqHPhGsV oVLQpyr3ttQdVbbH6cxkYmAJkZg2AYl6h1XR9BqavGNSC2EjVzBbgm/xTMq2gwto8qir UjsKMKIzGb0RNllfnlZHj1bqOsW6nIA/ZWqtBwuNYBRiib8Sb1zGNgOG/17AFGjZUdYR UeR5Jr+ZfM1sxHm8SfZu+IzfgsN8hwASZMRsE6sLjI7MPRIVfHv/7/6+uNqkRAq3JDhy QkKp1hzSbumGGYCS66x6h3CMI3JPRIJUEDVopLtbsjgJALodolwHIpait5gaxEaO0wn0 vnlA== 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=hTyHyLQYzEOA4uGWERB+WxPgnaDFfEzDVJ9NEcQymOA=; b=fArfn1Xj56Rr2WcCDi1iOEZa2McwComuNBuogDXHlwsx1nhHNdLgWD2S+JS/otDasS qo0DRibwDw1WcXcGjdifdq/PDbtOEekHF+m1JXajJMRxmcUqXZ1Ys5AM2zcbbaP4N2PW s6AEsw81Acm2Coi3cD3+3RQgNCRj7eYar331tIlUveZXXsa6YmOWwLYIejuGBS5l5Uv5 wb5dU/f2uZKMmYa1f4rS+yTlJi6QD/S3pT2svCOpS3ZAHMmwUddefLEbKieJXHgk6+Fl ZpY9DUJg965Dke+dqT7hkm/L8cOA2tAhrVykC7TBgza8208FbpMKLfN4lwF8XjK210nw 5xug== X-Gm-Message-State: AOAM531m8jSgJvb/1RpSovtGdy6GDd0yNPYRe7WYsa8ClsM5lGEKSnfg 4J607PXpBaLrwT9r6bUOiDa6MQ== X-Google-Smtp-Source: ABdhPJw5H5ZKTPpbqVElGplnJQ/vrdCiMzI0zx7nxayb7jgjvyYy2Vk7apfHRO1XNDK+qpYPc5C61g== X-Received: by 2002:a17:903:22c2:b0:12d:b609:a37e with SMTP id y2-20020a17090322c200b0012db609a37emr31041795plg.68.1629771207771; Mon, 23 Aug 2021 19:13:27 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([114.87.70.46]) by smtp.gmail.com with ESMTPSA id l12sm16720326pff.182.2021.08.23.19.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 19:13:27 -0700 (PDT) Date: Tue, 24 Aug 2021 10:13:11 +0800 From: Leo Yan To: James Clark Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo , Peter Zijlstra , Adrian Hunter , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , Russell King , Catalin Marinas , Mathieu Poirier , Suzuki K Poulose , Mike Leach , John Garry , Andi Kleen , Riccardo Mancini , Jin Yao , Li Huafei , coresight@lists.linaro.org Subject: Re: [PATCH v1 2/3] perf auxtrace: Add compat_auxtrace_mmap__{read_head|write_tail} Message-ID: <20210824021311.GB169379@leoy-ThinkPad-X240s> References: <20210809112727.596876-1-leo.yan@linaro.org> <20210809112727.596876-3-leo.yan@linaro.org> <2b4e0c07-a8df-cca6-6a94-328560f4b0c6@arm.com> <20210823095155.GC100516@leoy-ThinkPad-X240s> <319ee11a-06f7-abde-6495-d2175928b9fe@arm.com> <20210823121348.GE100516@leoy-ThinkPad-X240s> <1c0101fd-2ca6-4741-5d72-82d3e00bfeb6@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1c0101fd-2ca6-4741-5d72-82d3e00bfeb6@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210823_191331_131570_15E1003B X-CRM114-Status: GOOD ( 25.11 ) 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 Mon, Aug 23, 2021 at 05:00:14PM +0100, James Clark wrote: [...] > >> I couldn't see how it can ever return -1, it seems like it would loop forever > >> until it reads the correct value. > > > > I use this chunk comment to address the function > > compat_auxtrace_mmap__write_tail(): > > > > +int __weak compat_auxtrace_mmap__write_tail(struct auxtrace_mmap *mm, u64 tail) > > +{ > > + struct perf_event_mmap_page *pc = mm->userpg; > > + u64 mask = (u64)(UINT32_MAX) << 32; > > + > > + if (tail & mask) > > + return -1; > > + > > + /* Ensure all reads are done before we write the tail out */ > > + smp_mb(); > > + WRITE_ONCE(pc->aux_tail, tail); > > + return 0; > > +} > > > > Please let me know if this is okay or not? Otherwise, if you think > > the format can cause confusion, I'd like to split the comments into > > two sections, one section for reading AUX head and another is for > > writing AUX tail. > > I see what you mean now, I think keeping it in one section is fine, I would just > replace "When update the AUX tail and detects" with "When > compat_auxtrace_mmap__write_tail() detects". If the function name is there then > it's clear that it's not the return value of compat_auxtrace_mmap__read_head() Sure, will update and send out the new patch. Thanks for suggestion. Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel