Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3248849ybc; Thu, 14 Nov 2019 06:21:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzOiFmVwY3JF6t+nZjsxpxQLoqtrxC5IIBDnO5TDV/BocTep4x9BscChmOSVKB8ndEVWvVj X-Received: by 2002:a17:906:7746:: with SMTP id o6mr8592715ejn.140.1573741269778; Thu, 14 Nov 2019 06:21:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573741269; cv=none; d=google.com; s=arc-20160816; b=0g9NloO20E8hiQw4b5EvH6NFGXnGy8bqZkXsAy0hM7ePv+CIvDYGOMKWeUJeQQG688 C2VrbddC1VUpn3U9G8DzX0qE5WQ0ZplYXFIC9Vmps6U1ZMi5TzF4qzL8+uVN8evOQoUH shNfQPbwt3KQtqfEG6aW7emX+bYqMEBWzQxUSu4v+79yTpLx6BaBsCJ49LFFgFx+HciN XDC8GJ81cR/QHGqr0AuJp9FsSA70geupjlCotHLq/XuYkPUY+gR9CaKYK4GjkW9qtyz7 AVxyKXOK0on21+l5k8L3BTxsZPFYhcpNkJ1hys3fxltJ+yjMjr5V9nsqZNEzS6pfo4tT z3nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=molc5eRAZME31JWY6YTtN64cnoOSM4e4hD/r7/m5JEE=; b=eY5h1OoMuAjREYkqBovdbMtS8pAWJCu1xJMe2MiJobN58hh+jsQL+6GMrSQ9tJx8Zd h5JVg9DRGJfDiA4XLOjCwi/FxZHwR1YCEZ739TSXVvfcD96eqt6+H2eg1EQo+HjoKyzO BbdNpdUUqTz42XfwqYTeZVaXhlLX8G046qW8AdhteThbgTeXYtuxSwqpycccuqHx/HOZ /rKU+7FlM8Ya9HFybIHLbmS2v9O3knHFUkeo7uIoy29J/P39vF9d99qidTA0j9CqUyg8 8do/PuprdMyArQudPsqu93sjd/8i5XUHTwX0hL0VzcD08nJ7iO72vizC1INmPZXMJwQ1 Z0cQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jx16si3672714ejb.353.2019.11.14.06.20.44; Thu, 14 Nov 2019 06:21:09 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfKNOTQ (ORCPT + 99 others); Thu, 14 Nov 2019 09:19:16 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:40789 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbfKNOTQ (ORCPT ); Thu, 14 Nov 2019 09:19:16 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iVFxe-00046J-A5; Thu, 14 Nov 2019 15:19:02 +0100 Date: Thu, 14 Nov 2019 15:19:01 +0100 (CET) From: Thomas Gleixner To: Jianyong Wu cc: netdev@vger.kernel.org, yangbo.lu@nxp.com, john.stultz@linaro.org, pbonzini@redhat.com, sean.j.christopherson@intel.com, maz@kernel.org, richardcochran@gmail.com, Mark.Rutland@arm.com, will@kernel.org, suzuki.poulose@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Steve.Capper@arm.com, Kaly.Xin@arm.com, justin.he@arm.com, nd@arm.com Subject: Re: [RFC PATCH v7 4/7] time: Add mechanism to recognize clocksource in time_get_snapshot In-Reply-To: <20191114121358.6684-5-jianyong.wu@arm.com> Message-ID: References: <20191114121358.6684-1-jianyong.wu@arm.com> <20191114121358.6684-5-jianyong.wu@arm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Nov 2019, Jianyong Wu wrote: > From: Thomas Gleixner > In some scenario like return device time to ptp_kvm guest, > we need identify the current clocksource outside core time code. > A mechanism added to recognize the current clocksource > by export clocksource id in time_get_snapshot. Can you please replace that with the following: System time snapshots are not conveying information about the current clocksource which was used, but callers like the PTP KVM guest implementation have the requirement to evaluate the clocksource type to select the appropriate mechanism. Introduce a clocksource id field in struct clocksource which is by default set to CSID_GENERIC (0). Clocksource implementations can set that field to a value which allows to identify the clocksource. Store the clocksource id of the current clocksource in the system_time_snapshot so callers can evaluate which clocksource was used to take the snapshot and act accordingly. > diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h > new file mode 100644 > index 000000000000..93bec8426c44 > --- /dev/null > +++ b/include/linux/clocksource_ids.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _LINUX_CLOCKSOURCE_IDS_H > +#define _LINUX_CLOCKSOURCE_IDS_H > + > +/* Enum to give clocksources a unique identifier */ > +enum clocksource_ids { > + CSID_GENERIC = 0, > + CSID_ARM_ARCH_COUNTER, This should only add the infrastructure with just CSID_GENERIC in place. The ARM_ARCH variant needs to come in a seperate patch which adds the enum and uses it in the corresponding driver. Seperate means a patch doing only that and nothing else, i.e. not hidden in some other patch which actually makes use of it. Thanks, tglx