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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5D14C433FE for ; Fri, 4 Mar 2022 17:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241155AbiCDRxD (ORCPT ); Fri, 4 Mar 2022 12:53:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241063AbiCDRws (ORCPT ); Fri, 4 Mar 2022 12:52:48 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDA0213EF93; Fri, 4 Mar 2022 09:52:00 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1646416319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j8OFCPFSa6oQfjH+iv/tB8o6jAu2gKimlCc9TJAIFy4=; b=zZo0ux5V+K2cHYZx+23tEprylvn8885sqVfywbNmkqh4PJt9ktHZfmbab7xedzO7x/z7zv mM1k4p8UYnqBeX4x3Yqmzs0DiUtbl6lGEu8qT7o6S8Fp0h+mMlgnhsnOeiVDUXtLxHREm+ bsQRbGBZvjvJYS6qsQjnvf7Q8SJINPCk8l47XO/vxqJoKKYo9aYzmFx2CuAx9g4I87veLY aEe7DGH7+Q0tklQByR+Bjm29+xPviSbL/3kUPXfX6rWoo7zAcrNMaEdTHlbK/v+mEd3N2D BvullKcUGpqpJR9ECDrMqtn/BJCn70vPpcpPTsJ2VXg+1xDN5iuSOnEN+Up6ow== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1646416319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j8OFCPFSa6oQfjH+iv/tB8o6jAu2gKimlCc9TJAIFy4=; b=m8wUOgmZAnt2ufWtq4MkGU/TECRfVyX9MQkTHQ3irsIx3NsvyFOgiMG1jE/wIlmEu7ZnqZ i0CIcaePnxtZOgAQ== To: Peter Zijlstra , Adrian Hunter Cc: Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , linux-kernel@vger.kernel.org, Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, kvm@vger.kernel.org, H Peter Anvin , Mathieu Poirier , Suzuki K Poulose , Leo Yan Subject: Re: [PATCH V2 02/11] perf/x86: Add support for TSC as a perf event clock In-Reply-To: References: <20220214110914.268126-1-adrian.hunter@intel.com> <20220214110914.268126-3-adrian.hunter@intel.com> Date: Fri, 04 Mar 2022 18:51:58 +0100 Message-ID: <8735jxa9mp.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 04 2022 at 13:32, Peter Zijlstra wrote: > On Mon, Feb 14, 2022 at 01:09:05PM +0200, Adrian Hunter wrote: >> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h >> index 82858b697c05..e8617efd552b 100644 >> --- a/include/uapi/linux/perf_event.h >> +++ b/include/uapi/linux/perf_event.h >> @@ -290,6 +290,15 @@ enum { >> PERF_TXN_ABORT_SHIFT = 32, >> }; >> >> +/* >> + * If supported, clockid value to select an architecture dependent hardware >> + * clock. Note this means the unit of time is ticks not nanoseconds. >> + * Requires ns_clockid to be set in addition to use_clockid. >> + * On x86, this clock is provided by the rdtsc instruction, and is not >> + * paravirtualized. >> + */ >> +#define CLOCK_PERF_HW_CLOCK 0x10000000 >> + >> /* >> * The format of the data returned by read() on a perf event fd, >> * as specified by attr.read_format: >> @@ -409,7 +418,8 @@ struct perf_event_attr { >> inherit_thread : 1, /* children only inherit if cloned with CLONE_THREAD */ >> remove_on_exec : 1, /* event is removed from task on exec */ >> sigtrap : 1, /* send synchronous SIGTRAP on event */ >> - __reserved_1 : 26; >> + ns_clockid : 1, /* non-standard clockid */ >> + __reserved_1 : 25; >> >> union { >> __u32 wakeup_events; /* wakeup every n events */ > > Thomas, do we want to gate this behind this magic flag, or can that > CLOCKID be granted unconditionally? I'm not seeing a point in that flag and please define the clock id where the other clockids are defined. We want a proper ID range for such magically defined clocks. We use INT_MIN < id < 16 today. I have plans to expand the ID space past 16, so using something like the above is fine. Thanks, tglx