From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 7BF6E1EB9E1 for ; Mon, 20 Jan 2025 16:44:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737391482; cv=none; b=C1zl2d78d6inqkCaJaJWrDtoBRYYNA2qj38LwXqPxrs9SgNd+fkAn21T47INnKqBeXGJKEakiaXpA/+byo6ApyWc/xD2WmtSpLRtVT3p1slLFoxjgsnLdDllhiPNp3qx/Bp2HEoq8Nq1Zq7Pv42tWRWU06tX9DMcwxgYIJAF7sU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737391482; c=relaxed/simple; bh=fUu5Vv48Ee8a3j7JuUfHfbw43HS7AvWpANZbM99oDfg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jjMurSjQvpM/4IC9eNDqf6ia1/Xw+GZnE1Nzi5fM35A/JKjyBpGjZQYomxXZ1S/47ociZay25SUBoUVHgchvm6HM9waJxi41FW1K03dG7wwRq8NsbL7dHGVqLB4e5rHfGx3aHh7RmistJ/3O61gb7gQe9ssrHNsjRKDr/+vZCZ0= 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=SeFXHWyN; arc=none smtp.client-ip=198.175.65.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SeFXHWyN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737391481; x=1768927481; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=fUu5Vv48Ee8a3j7JuUfHfbw43HS7AvWpANZbM99oDfg=; b=SeFXHWyNQ9sBrP+WLmnqRpi3lrD9YcXZLuTr7hO9rcadIBoI/4BeFzIu DV/o7VFB36HyyVpDVhg00za/ap5YkO8pp4njmsWqBQEdNFzZ3WptD2hZN 79NxVFVpOK9pngInoTbZE2k1yNYabJRvQtSRxnvQilEtvxLQK7NOq1FAO WeoQVB1yytnMVdh462l4Yh/dI4KGcFD7qh6+mcBRVwqu25qZWbhgcF+aV Amng4I8Vx77CwusEu7UspT4R2CiN8nlpV2GE2CywPewt36QIVINaQOvH6 ZJ7KjazgzmXOYOxzFbJR73hR7GRjXxRultGsqfzizJv1vRROd0GSR/gVg w==; X-CSE-ConnectionGUID: JCu/JxDvTsWtExmgvwdDDg== X-CSE-MsgGUID: jRZRRBNgQ6CF/hKNr3oBCw== X-IronPort-AV: E=McAfee;i="6700,10204,11321"; a="48788213" X-IronPort-AV: E=Sophos;i="6.13,219,1732608000"; d="scan'208";a="48788213" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2025 08:44:40 -0800 X-CSE-ConnectionGUID: GGC8SDhkSHG61EZPy9xoww== X-CSE-MsgGUID: gQEG1SSkSMK3KdjfR78gLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="143844678" Received: from linux.intel.com ([10.54.29.200]) by orviesa001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2025 08:44:40 -0800 Received: from [10.246.136.10] (kliang2-mobl1.ccr.corp.intel.com [10.246.136.10]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 980A420B5713; Mon, 20 Jan 2025 08:44:38 -0800 (PST) Message-ID: <31ad367a-721f-46e7-8e5f-e96b250a8a32@linux.intel.com> Date: Mon, 20 Jan 2025 11:44:37 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: perf: is it possible to userspace rdpmc but only on a certain core type To: Vince Weaver , peterz@infradead.org Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-kernel@vger.kernel.org, Andi Kleen References: Content-Language: en-US From: "Liang, Kan" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2025-01-17 5:04 p.m., Vince Weaver wrote: > Hello > > so we've been working on PAPI support for Intel Top-Down events, which > let's say does "exciting" things involving the rdpmc instruction. > > One issue we are having is that on a hybrid machine (Raptor Lake in this > case with performance/efficiency cores) there is no top-down support > for the E-cores, and it will gpf/segfault if you try to rdpmc the top-down > events. > > Obviously PAPI would like to avoid this, and somehow only run the rdpmc > from userspace if scheduled on a P-core. > > Is there any way to atomically do this? Somehow detect what core we are > on and atomically execute a userspace instruction before a core-reschedule > can happen? > > Or barring that, any other way to handle this in a way that won't crash > without having to have the users have to bind to a core any time they want > to run PAPI? Can the PAPI rely on the event_idx(), similar to what Andi's pmu-tools do? For a stopped event, the index is always 0. https://github.com/andikleen/pmu-tools/blob/master/jevents/rdpmc.c#L117 Thanks, Kan