Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5692471ybe; Tue, 17 Sep 2019 11:57:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVHAoZtbYk+Uu/iiJOgqD/1HHJrLWz9xBFIB/T4AIjJuLmB3XvcvAKLe6hHl490DSRcBRC X-Received: by 2002:a50:aa96:: with SMTP id q22mr6272691edc.179.1568746655476; Tue, 17 Sep 2019 11:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568746655; cv=none; d=google.com; s=arc-20160816; b=VHyXDzzySnmY5idMSHIn9Q9RwUCzibkdrDCtsZk8uCgZt7b0LxPc+5W104KsHuTNbp PSsd7Wn3FQB8WsKVL0VfFoRfLboKaiI71LuVjSfWFBDcrNCjX+JJYzExYYUrzqqGxZ4G WoHDbMVwkRSLZW+ICzl+pY9ZQ7VOMKoEbWQEUuqPoVsv3X4I+joMvaUfbnH+pxgcCGes VSFBwZDHvN7BJbbZ5bBWrvIQZwNxFgWXdcZGrpGTw9tv3IyJFL5zWc2ULctNoasSLMlA bpO19Wz6tgYdvZq4xXT8wZsv/qjqE5NTmSLjofNb9KVAEEeW0qinYRJ26u2H9rnKEB4T vU3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=XP4WYpQTeMQpf1Qp9HV9ATuUzi2qO6XTQBzzgkoWE/o=; b=JfGaK7tYWK2pchM1fP2g/3i1y5zHigfwApIahlycu19mxmf1WFkS0/OUWlORDNVEW3 PcFIxbZmeEuTIQEelm3NkeJ5/opKw2ByZ0flHWFlnmKFFscNi4gP2XUutsK2xVcQAWjU PzRk4rC7LqeU+oAziMoPYTC++pmDj7gy0EHMqbsF74ORAQU8zDsqfWIf8a0YnD70M14Y ax2MqbsGSMGWOI5zGKpX0aXJpGRicz1z9sAgILLIAUWv6i7alCGMR+9M1qOoGE6/XG/9 83I/FfVxdgWcn7RpFtVfn1tzy3/gcd/xJUVAsvqiMdKJwQcHoyEczyHZ0UmgQQ6c/vSp gIeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si1859799edx.223.2019.09.17.11.57.12; Tue, 17 Sep 2019 11:57:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbfIQRKa (ORCPT + 99 others); Tue, 17 Sep 2019 13:10:30 -0400 Received: from foss.arm.com ([217.140.110.172]:59086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfIQRKa (ORCPT ); Tue, 17 Sep 2019 13:10:30 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8468328; Tue, 17 Sep 2019 10:10:29 -0700 (PDT) Received: from [10.1.197.61] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D136B3F575; Tue, 17 Sep 2019 10:10:27 -0700 (PDT) Subject: Re: [PATCH 3/6] Timer: expose monotonic clock and counter value To: Jianyong Wu , netdev@vger.kernel.org, pbonzini@redhat.com, sean.j.christopherson@intel.com, richardcochran@gmail.com, Mark.Rutland@arm.com, Will.Deacon@arm.com, suzuki.poulose@arm.com Cc: linux-kernel@vger.kernel.org, Steve.Capper@arm.com, Kaly.Xin@arm.com, justin.he@arm.com, nd@arm.com, linux-arm-kernel@lists.infradead.org References: <20190917112430.45680-1-jianyong.wu@arm.com> <20190917112430.45680-4-jianyong.wu@arm.com> From: Marc Zyngier Organization: Approximate Message-ID: Date: Tue, 17 Sep 2019 18:10:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20190917112430.45680-4-jianyong.wu@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/09/2019 12:24, Jianyong Wu wrote: > A number of PTP drivers (such as ptp-kvm) are assuming what the > current clock source is, which could lead to interesting effects on > systems where the clocksource can change depending on external events. > > For this purpose, add a new API that retrives both the current > monotonic clock as well as its counter value. > > Signed-off-by: Marc Zyngier > Signed-off-by: Jianyong Wu There must be something wrong with the way you've taken this patch in your tree. My authorship is gone (not that I deeply care about it, but it is good practice to keep attributions), and the subject line has been rewritten. I'd appreciate it if you could fix this in a future revision of this series. For reference, the original patch is here[1]. > --- > include/linux/timekeeping.h | 3 +++ > kernel/time/timekeeping.c | 13 +++++++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h > index a8ab0f143ac4..a5389adaa8bc 100644 > --- a/include/linux/timekeeping.h > +++ b/include/linux/timekeeping.h > @@ -247,6 +247,9 @@ extern int get_device_system_crosststamp( > struct system_time_snapshot *history, > struct system_device_crosststamp *xtstamp); > > +/* Obtain current monotonic clock and its counter value */ > +extern void get_current_counterval(struct system_counterval_t *sc); > + > /* > * Simultaneously snapshot realtime and monotonic raw clocks > */ > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c > index 44b726bab4bd..07a0969625b1 100644 > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -1098,6 +1098,19 @@ static bool cycle_between(u64 before, u64 test, u64 after) > return false; > } > > +/** > + * get_current_counterval - Snapshot the current clocksource and counter value > + * @sc: Pointer to a struct containing the current clocksource and its value > + */ > +void get_current_counterval(struct system_counterval_t *sc) > +{ > + struct timekeeper *tk = &tk_core.timekeeper; > + > + sc->cs = READ_ONCE(tk->tkr_mono.clock); > + sc->cycles = sc->cs->read(sc->cs); > +} > +EXPORT_SYMBOL_GPL(get_current_counterval); This export wasn't in my original patch. I guess you need it because your ptp driver builds as a module? It'd be good to mention it in the commit log. > + > /** > * get_device_system_crosststamp - Synchronously capture system/device timestamp > * @get_time_fn: Callback to get simultaneous device time and > Thanks, M. [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=timer/counterval&id=a6e8abce025691b6a55e1c195878d7f76bfeb9d1 -- Jazz is not dead, it just smells funny...