Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp615670rdb; Thu, 8 Feb 2024 16:13:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX5f9aJOFzk3sdGTb8VsHYOrXjJQKacrCtxvWMshUJfqidR827Af6weppK6XfFD0nj2O0vEVeAhR6PziGX/qbeNOHR4CfiBj++hyPAl6A== X-Google-Smtp-Source: AGHT+IEOYhd2x1JeceTVjgS9Tj7JOGNNggI50cJqIv9sjyI+8jUmye5Tz5idP4LOi+TESX1Wmoc5 X-Received: by 2002:a05:6808:3195:b0:3be:c44b:f129 with SMTP id cd21-20020a056808319500b003bec44bf129mr112289oib.11.1707437627674; Thu, 08 Feb 2024 16:13:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707437627; cv=pass; d=google.com; s=arc-20160816; b=tk62SXQzqVlhX+c1WKCeEUW9nbv9Mc3Fxo14a+Gi/oOyTh6r+BF3ZSlO75vvIEwW1X sVbi1P5KdLZsI3/z8wLkPafLnzMWgs7H6EoXbbrhiv/Pnwwz+Ds+5KP/t2tQrmvciRIA LOo5w6b1xRcQJW88zsyZWbptJ3QZQnqYAUt1a/Atst3pPRhLSx3ASV9DFJqn+sxiIkG4 A1DfyGzUtXLQ5Uq/906rUjpJYSkoBUqjPRQApA5V/8jCK077IV8yhcmuW45ycMZDArTJ Zju+fB0x+iTT0dB7IM+dM7Omk+HHrnrkBn6xTu08KX3hBbQBZE8lZwaLXXyWBplt3gUd qy6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9CEZajrxhUlhvTxM6n4bl1qZEwJy/tFrjAXZjC74LRI=; fh=i0yUO52PESPNJJPVora3xxN/huTxwVUEzxpJygJbUvU=; b=omKBwy/podNpQdFL2XdUa7bsHdkSQFbtFnfmmo5LFuqkLjbn228oou4xywUvNgEQjO 6alG8O3IzwXV2s+lrtLEl12UT9J7Gjyr/nsKzpwTl+LKr2mlbvNT+MDFfdmPv/jOtPTL 76ZFZc7GDaKvqiNBpBhsm1lqioeWgUQZ7VhRYetyMhHus6rjzR68mxFABWa9Em73ll6y 8FrTmb8qlMu5nhbMwYYq/lbB/w/z27tYWn1a07qlCqyk1eQc8VH3hjSYVDWbQy/kay6u CZVrQ7NAOdL+FsPJcQ6P9Rdmjp30LzkRvpNGB8rYxDeK9DowlI1YMVO/RJ23oDncueJg dOmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G5iSCkXe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXMbZj/ScpZ6Q5xkQ+B6xSxe1kDd9y95+A2GDmA+w5Q2je/a91RfJu5ZmyRr6ljRC+WAcD4liuncpRlqgmvlXd6bHfrIQyxbpm057Ykug== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z2-20020a63ac42000000b005d8e2f56d86si661439pgn.629.2024.02.08.16.13.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 16:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G5iSCkXe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58894-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58894-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5481E2843F1 for ; Fri, 9 Feb 2024 00:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0C0C4C65; Fri, 9 Feb 2024 00:13:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="G5iSCkXe" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87F3A4A21; Fri, 9 Feb 2024 00:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707437619; cv=none; b=aNfOfeiYqeiM3IjslivHzFCbsQmiMoRcf2H3LmiEWVTIoyfX0XuhaBVYopgY1uqrfgQaJVICsvxIpt8SaXfSX8C2gjqwqe1RpejdGcYWgqc6ol6fKZY14r90tnqz4K6xWpyqaYdXQPDDe8HIplphHce3y4cgX9mpEgD+AJ0mpYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707437619; c=relaxed/simple; bh=bi/0TOx79W8gC2c7v4EQ3+j3O2OhN2gIGw5Zazdda3Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dOJ6skodFDRR20CsLxccGRB+ZNbvXGwUDQNNC9LPiUihQ47WEFYmUuhjDaSkVqsv/OWUbWy8ULIBRDNjRw/8mgt0le1q5rzP9odMBpYz87l6scfBrlYOUzQXTyDv/PO7ONfPqV/Y0yr19S70d/hw4+jwV0Jm6kS245+vWpZotEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=G5iSCkXe; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707437617; x=1738973617; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=bi/0TOx79W8gC2c7v4EQ3+j3O2OhN2gIGw5Zazdda3Q=; b=G5iSCkXeulNRRrl+EltAGHFSsZAfSTVxRWXjsUsnZHJh9zBiOXY6eB26 dF1AO+egFOYx8KLk4kMYwJyI3oIAADBvJbjjI9ACILGfoHtf1tq5EN63K R0VeucnmCD0j+3cCuImS048Ex2gtKOGfL270myTsPgk5ZfVOork4EKmlV K8Mw0n+JQHOyInlC5Sn+ckOp1XdW70m8SHlSeJwzCzr9tbmQULzv1yecs LSerRpQm45kHZ/WzWnIufoRA0l6zsiXYPcfoJZErkYXflwa7OORGrT6Nr v8HMXHFHE9+bLSooX4LuEEMQYXYecOJS8ReE98qwJrkC1/Vd/dfP4TEIH Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="1501368" X-IronPort-AV: E=Sophos;i="6.05,255,1701158400"; d="scan'208";a="1501368" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 16:13:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,255,1701158400"; d="scan'208";a="6432514" Received: from tassilo.jf.intel.com (HELO tassilo) ([10.54.38.190]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 16:13:36 -0800 Date: Thu, 8 Feb 2024 16:13:31 -0800 From: Andi Kleen To: Adrian Hunter 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 Subject: Re: [PATCH V5 01/12] perf/core: Add aux_pause, aux_resume, aux_start_paused Message-ID: References: <20240208113127.22216-1-adrian.hunter@intel.com> <20240208113127.22216-2-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240208113127.22216-2-adrian.hunter@intel.com> > +static void __perf_event_aux_pause(struct perf_event *event, bool pause) > +{ > + if (pause) { > + if (!READ_ONCE(event->aux_paused)) { > + WRITE_ONCE(event->aux_paused, 1); > + event->pmu->stop(event, PERF_EF_PAUSE); > + } > + } else { > + if (READ_ONCE(event->aux_paused)) { > + WRITE_ONCE(event->aux_paused, 0); > + event->pmu->start(event, PERF_EF_RESUME); > + } This doesn't look atomic. Either the READ/WRITE once are not needed, or you need an actually atomic construct. > + > + rb = ring_buffer_get(event); > + if (!rb) > + return; > + > + local_irq_save(flags); > + /* Guard against NMI, NMI loses here */ > + if (READ_ONCE(rb->aux_in_pause_resume)) > + goto out_restore; > + WRITE_ONCE(rb->aux_in_pause_resume, 1); > + barrier(); > + __perf_event_aux_pause(event, pause); > + barrier(); > + WRITE_ONCE(rb->aux_in_pause_resume, 0); Dito. -Andi