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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1A5C0C4829B for ; Mon, 12 Feb 2024 06:43:39 +0000 (UTC) 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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1h8YIxjpoE4QzbMlIyYi/cRiSlOK/Nb+8QoaUXoKxqY=; b=rwruXpWnYsJdXF /SwjLL3QAuijh4213+zikJxdhdNhmfJmgBZ2tvjtEDNQ6g54RHoyNmAnO6XTlI95gAvjzI6qIGf7T Jn371pjGDDP6VG7myquHmmNBSSyxpt9GLAfqZWoWEhn02O+KCvkiuUNy4tRN/UGrZBrHxitiF/QLH RTyc9pezyJg8sibnD23LJM0gEU0/w6dCStOR+jWTNnKjxihI+pCgvigiCUJukilZcDqbAGOkWP/q4 7HBgvTm2bbhpeMk1nq+Na/dgpTCLlWKbBAGOUrMcWF+t/8Hhmg4eap8varY5D1Xy9K9xsI3+PxW09 qCR6YHs4k4HhAGCTFjVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZQ2H-00000004POf-1JPE; Mon, 12 Feb 2024 06:43:25 +0000 Received: from mgamail.intel.com ([198.175.65.21]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZQ2E-00000004PO5-2ytQ for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2024 06:43:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707720203; x=1739256203; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=JEaLXdeo6fNthLC6iDS4VCiLgLO+VSbXbp2Vu7m6SIc=; b=gtbDJNpaEzDuE7VBW0QWc/dqUg/7e5aPGnNqCXAlL31X5N9X7b8UnrfW DvFNhr7VI8OgrDSboCLLQiZee80VTXEM0io70cNxgFaR+plGJmgoBdg8s 3LTyVdU+JRc7gKypfZzV96CE6n6CktZxzittrmib+yFvKfcQ9O4GENXVb iRQtlmvEq3l6wbkA0/fkG797oxACNrDgLoeUwlaKtH9B0xtPRHSqFDaG0 kN27YJQm0BrE+SY19O50EIJ9eK7rm1P1GsJ2SZwtoyjPguM5Ol+5ExAa8 +qt/YJ6ts4SheugFk869oIk3FZQEh5NUqNrny67mN89yqdUhTFOBUDLaH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="1585985" X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="1585985" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2024 22:43:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="33288927" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.43.27]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2024 22:43:14 -0800 Message-ID: <05ac66fc-ddda-46ff-b08d-c15943c16bc1@intel.com> Date: Mon, 12 Feb 2024 08:43:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V5 01/12] perf/core: Add aux_pause, aux_resume, aux_start_paused To: Andi Kleen Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Heiko Carstens , Thomas Richter , Hendrik Brueckner , Suzuki K Poulose , Mike Leach , James Clark , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Yicong Yang , Jonathan Cameron , Will Deacon , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20240208113127.22216-1-adrian.hunter@intel.com> <20240208113127.22216-2-adrian.hunter@intel.com> Content-Language: en-US From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240211_224322_841359_11F9A1B0 X-CRM114-Status: GOOD ( 14.14 ) 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 9/02/24 23:10, Andi Kleen wrote: >> The writes to rb->aux_in_pause_resume must be done >> only once. It might be possible to get away without >> WRITE_ONCE(), but really the compiler should be informed >> not to make assumptions. > > What stops the NMI from firing here? That would be fine. > >>>> + if (READ_ONCE(rb->aux_in_pause_resume)) >>>> + /* Guard against NMI, NMI loses here */ >>>> + goto out_restore; > <----------------------- NMI That would be fine. >>>> + WRITE_ONCE(rb->aux_in_pause_resume, 1); >From here on, the NMI will see rb->aux_in_pause_resume == 1 and do nothing, up to the point when rb->aux_in_pause_resume == 0 again. This code is about guarding against NMI. Interrupts are disabled, and the rb and event only operate on 1 cpu at a time. > > > Even if it isn't racy it needs a clear comment. It has a comment, but it could be more explanatory. The code paradigm is also used in perf_pmu_snapshot_aux(). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel