Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp782398iog; Fri, 17 Jun 2022 13:34:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uVN6WODB2fUC3E0ZsPC0jWLt4TG93VV8s3J6dgSLzHKPyWo/iQwCtczhOtzJ/ZdWFxRuWX X-Received: by 2002:a17:907:62a8:b0:6fe:8b21:4a0d with SMTP id nd40-20020a17090762a800b006fe8b214a0dmr10813143ejc.84.1655498086463; Fri, 17 Jun 2022 13:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655498086; cv=none; d=google.com; s=arc-20160816; b=vp7MCohdzIYEPkOXJDrvkw99R8JfrEnwRudnRn/pq/5G0NMwVhqTKSLqujJGAVgRkG 1YNUwedb+AmV/lRsvh9xVyIbPr+LQkbYtviINeNUgT1RH+Bi3FgDewonf4HXm2EGjR8d sH2VcxRdHJwtNpPoxxNFqJtexLSlWHZhewYbXAEoWS36uWq2aFX3GVVbLYs2hW5b8p0F Vr1VDmXpMpeP1U5vJEQRlpI2r/c2/oy3fSCuwhw2leG9MDeH/PEjNrrnbCGYduTAYDxH Il+y++Z2PocqaYFL74yYMfCQ4r9h3+N3rhJ8AuR60FuxNL8YnEzw/2DJ1KrR5L8VilKB 90uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:date:from :dkim-signature; bh=c6HUnYkSdwKF6VwZqapAdI/2A9eVLq9BatAO2vrrJnw=; b=cjJqRDk5tEBPeiqKyG9FczxrAwVSGrHaXsBBVq/KlLQf+ffRbpWHmMQ/PDicEQIgJw MpfJ8qlGyQNE126F/DXnAQG8GtbpqS1mj5dGCkmmfXEmlmla6Nv8yLkyyljg7Ap+kCUs L9jpUUFPlRBkc5dxQ5KCwPKDfddXmK89ouwdABLbfWHyr2OGla5wRFneM5pYiT126by4 KwaOmmalsTEd02I7hOpG1uif/0ojxHlE/L2ajn//P3xAlGrgDiS/d0GUhPa2z/XJitTH 6BVs3Ah2tDsSmc688+UQvTC4IEoLY3aw3b0BBuWTX4A6ogCcF7/qBTXQroOF3IkHZ7Ba 2N5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@maine.edu header.s=google header.b=dH4hwY+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=maine.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a0564021e9200b0042dcf5f5921si7174598edf.597.2022.06.17.13.34.18; Fri, 17 Jun 2022 13:34:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@maine.edu header.s=google header.b=dH4hwY+J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=maine.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237678AbiFQUN3 (ORCPT + 99 others); Fri, 17 Jun 2022 16:13:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231890AbiFQUN0 (ORCPT ); Fri, 17 Jun 2022 16:13:26 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552295C35E for ; Fri, 17 Jun 2022 13:13:25 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id q104so7966474qvq.8 for ; Fri, 17 Jun 2022 13:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maine.edu; s=google; h=from:date:to:cc:subject:message-id:mime-version; bh=c6HUnYkSdwKF6VwZqapAdI/2A9eVLq9BatAO2vrrJnw=; b=dH4hwY+JUwHqWAOnAMYh+qe4C+Zef5b8t/2v0ZWIpDQgfFra8a1MhYCcJimdS4//xt NrDPCFSEbNQwuuksbTvqwPZg5hVEasYajGDsYCNSDtGEt4irD7DmKtmemXhMKCZ30Ulm u8EpbvZhHMmUQlD6ngiG4FiwhmzGXOlFK6tLo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:mime-version; bh=c6HUnYkSdwKF6VwZqapAdI/2A9eVLq9BatAO2vrrJnw=; b=tbkAHn/bh2gM1Z5fdpzrtkarkxNx7ivBXKy0CtriXv01kFgByh7i4hLzZCASnJ0N0j 3K7wNtM5AgfvnGi91jc1jtLAoEU1nv6E+kpqlQRHsMhsM3I3o7nxoNsnI0W+BNSMJCrq Gytx4kqW7DmsHv7P8XMb8cvzxU/b+fb616qO4bKJlZf9+Dy3mdWvnpboyyMVL6dibPdm nYB6pVluiwidj4gT0ed+kmrMYSpLkbWoHo2YFYJmtMYvSUkhmiHjYGzu9BHoVQM0HI7m UozPWZT6mz3jr2nMsLpTNlYFedIWsgQwHm1W/yVUurTFYegxAY4Z6rJ0k1vtlmGUg0Cf Aipg== X-Gm-Message-State: AJIora/PKJAgZJQzc7E2w0vSqvP+XVyh1hJEL/8UKNOMeDAX0LWKlQkQ qC9MbOrW+9rcSBNgl4h78QoOEbYJ/u40fA== X-Received: by 2002:ad4:5bc1:0:b0:42c:531c:ef12 with SMTP id t1-20020ad45bc1000000b0042c531cef12mr9984516qvt.15.1655496804161; Fri, 17 Jun 2022 13:13:24 -0700 (PDT) Received: from macbook-air.local (weaver.eece.maine.edu. [130.111.218.23]) by smtp.gmail.com with ESMTPSA id z13-20020a05622a060d00b00304eb8e880dsm5689926qta.23.2022.06.17.13.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 13:13:23 -0700 (PDT) From: Vince Weaver X-Google-Original-From: Vince Weaver Date: Fri, 17 Jun 2022 16:13:22 -0400 (EDT) To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org cc: Mark Rutland , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Will Deacon , Alexander Shishkin , Ingo Molnar Subject: READ_ONCE() usage in perf_mmap_read_self() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Is the perf_mmap__read_self() interface as found in tools/lib/perf/mmap.c the "official" interface for accessing the perf mmap info from userspace? Are the READ_ONCE() calls required? If they are left out, will accessing the mmap interface potentially fail? Has this ever been seen in practice? Part of why I am asking is both tools/lib/perf/mmap.c and tools/linux/compiler.h (which defines READ_ONCE) have SPDX headers indicating they are GPL-2.0 licensed, which means it seems like it would not be possible to easily use the perf mmap interface from BSD-licensed code. Would it be possible to get those two files re-licensed? The (BSD-licensed) PAPI is currently using a mmap reading interface based on early documentation for the feature, but it isn't 100% the same as the version from libperf (and isn't using READ_ONCE). Life would be easier if we could use the perf version of the code because then we would have one less variable to deal with when trying to track down issues. Vince Weaver vincent.weaver@maine.edu