Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1870933rdb; Sun, 11 Feb 2024 00:41:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXXkHSZEOpmDbWV2AGbnEsxRBXGbutTPOAmgSD0w4sZfuCbdXel+zY14pmAqiVNaRBseTrXZpwUItxeHZXW+lkvcuPte3WFjq3jrGep4Q== X-Google-Smtp-Source: AGHT+IHTV1ZbQN6+Lh46ZMRaNAuWmiYH2JNPkgD+s2IQY9879ZSaXGQ2BFNifkDDH5TfOlFFVUMN X-Received: by 2002:a17:907:76cc:b0:a3b:ae82:a721 with SMTP id kf12-20020a17090776cc00b00a3bae82a721mr2389970ejc.77.1707640918733; Sun, 11 Feb 2024 00:41:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707640918; cv=pass; d=google.com; s=arc-20160816; b=R97g3yQLg76JsumbMWyCu7Tr6tNwuf9g0iduPkQMJkB1IQQDJy5gl2ij6WbVy5Mnf5 FfpRjObnQea2jKYei8s7cVrgWlRVHtCnVb2JUCeE7gxeXWGbyepD9JF5CQaDhdHMDlrU kr8IhHIlarmYIWvEmsA93Y99hf2MyGZl4f4ULNISX9sOFnW8cNb4lHbZtc2/7xFbEMQG O0erYjWjyY4/I8KLeAof0Fb7zr5SRalFq2L/vGYy1PfAa7Fnv+BGSwi11/TQfwGBd9ZB nxAALcqtUQDaJeZIDYaq34B2wg9O6txEesooxXE3OHWipFR03vNAIUazvh+ypyNJNrHr /ACw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=ePxOaAvGz0Sgteknc0uzMhxWCumwMD+XW9dqKXQ/BHg=; fh=55tslv6kqRjHvHcNWWjyFBKzaFq9kTvvUyViTbchGzc=; b=BP4Rhw13Bgc6I2pCxGSpwrcM0KN1jieL4MFFe+K3ptfbHxM1DoRTHPhmn+gX4zbSd8 xdgtQ7RwkJscyReh8A+WFeLFgRm1utNiOAUN6XvHYpGm7xKCl7rO77I0lmGt6dNOxJ/z Q/FVD1mE7mNtfl3E8+WaMa91R8bsuFFzK6KNoCv0ZwxnLbgE2reA/ZPdAPk69n+9uWxQ 1eqgcQ73wAKGZfqIrwUONGYKDf80M+X80ONEGKJ5BNTH79Aw6NPhUHkItTzESotSSMhN tofUTDTZZASa9F8MxdWH/cCVmQAmpvhGBcytxbGChCPFWo206UQ21V6fcDoyP8AV/oZ8 yTSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oHn2cLOv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-60662-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCU9PxIIWkKTas4Rt8bQaJSwGuDv48Pz8QKcq7bhz0HjALyDLSmjQ0F1E7fm4dPTtAMz87SCcF35cHVRnxZd8GxG+JnWiA8X62wSJQaORw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hg2-20020a1709072cc200b00a3c224deacasi1716265ejc.356.2024.02.11.00.41.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 00:41:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60662-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oHn2cLOv; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-60662-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60662-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 751B11F22A14 for ; Sun, 11 Feb 2024 08:41:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E630859B48; Sun, 11 Feb 2024 08:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="oHn2cLOv"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="t9aMmjTO" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 734BC58AB6; Sun, 11 Feb 2024 08:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707640894; cv=none; b=qE10VcPD1xgh/XtN40zaNbmxAaSjHQM8b1IuhuKOXqXEFEshYSKqEbwTsWYvEic9rI3w0gTFX5m6ecpNOqLnDVAK4xiSu9h2jOcIqgBDGq0BEsL9DlseXwSNe3ASPbCiezMOOMLb8kB+BGQaxj85SvwDYsyxeZCBoTDPTpoquzc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707640894; c=relaxed/simple; bh=eQrEQwdcV2jCF31eWgwV5ZmXQRMWQcIOfoZbOM88Fi0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=R9FawJZSB2NyTNSFRUfFqZHQCSI6RqaEhesmogMEBNibTSyJ28X33+4+C8lg9lBEbWCLlTiTVL8iwAQiyzpTLxlQx5UgLV97eQvAVl/5AncDvRTI2tVRQcrnyHyZYMP6MMeiRLXq5OVn4hhxXUekCbVbBuoFJLydsIWKy1qzAOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=oHn2cLOv; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=t9aMmjTO; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Sun, 11 Feb 2024 08:41:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707640890; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ePxOaAvGz0Sgteknc0uzMhxWCumwMD+XW9dqKXQ/BHg=; b=oHn2cLOvXVX6h6AISVYgf7XVvhDXcnhChy7ERb/mVnhlq29BcZsy/LbZ2QyvXbKc0MTIRe XDThrX6Mjnn64SCs4f4Sgq6Yn6j4Nv3IWuC4WwHkCgx5Se/1YSnXe69DvlZ6ToHZUreVxx Cwtae66NHUEfgqDOrlwKWmmYJJfV9lPYQxNkGPuZfwt0LJdICZOGOHlw8N65Rj0Pe+kfzq 5SfnGwV43qX2gVpqTHB2wOn5cGGUKIPMaQ9IPjaywhLmR7Z2NAN5aL1m7MwXUTpQ2bgew5 kVxBIgMwLcdvJKCij6pJPE8EJG7HKCalv/7zLnFQEXNJfUNocFJkDCPh2ETwOQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707640890; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ePxOaAvGz0Sgteknc0uzMhxWCumwMD+XW9dqKXQ/BHg=; b=t9aMmjTOjaqsW/ZAutnPVbjlGAUVXwdpCvIeoJgvVEpR+1M/ftz9MaSl764/rlQ9FRSmYY efcVJcaezP+J/6AA== From: "tip-bot2 for Peter Hilber" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/ptp] timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Cc: Peter Hilber , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240201010453.2212371-7-peter.hilber@opensynergy.com> References: <20240201010453.2212371-7-peter.hilber@opensynergy.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170764088938.398.12709802708724247162.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the timers/ptp branch of tip: Commit-ID: 4b7f521229ef4eee06848427d865954e6e0e3675 Gitweb: https://git.kernel.org/tip/4b7f521229ef4eee06848427d865954e6e0e3675 Author: Peter Hilber AuthorDate: Thu, 01 Feb 2024 02:04:51 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 07 Feb 2024 17:05:21 +01:00 timekeeping: Evaluate system_counterval_t.cs_id instead of .cs Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the ARM Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Address this by evaluating the clocksource ID, rather than the clocksource pointer, of struct system_counterval_t. By this, setting the clocksource pointer becomes unneeded, and get_device_system_crosststamp() callers will no longer need to supply clocksource pointers. All relevant clocksource drivers provide the ID, so this change is not changing the behaviour. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240201010453.2212371-7-peter.hilber@opensynergy.com --- include/linux/timekeeping.h | 10 +++++----- kernel/time/timekeeping.c | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index ca234fa..3538c5b 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -268,13 +268,13 @@ struct system_device_crosststamp { }; /** - * struct system_counterval_t - system counter value with the pointer to the + * struct system_counterval_t - system counter value with the ID of the * corresponding clocksource * @cycles: System counter value - * @cs: Clocksource corresponding to system counter value. Used by - * timekeeping code to verify comparibility of two cycle values - * @cs_id: Clocksource ID corresponding to system counter value. To be - * used instead of cs in the future. + * @cs: Clocksource corresponding to system counter value. Timekeeping + * code now evaluates cs_id instead. + * @cs_id: Clocksource ID corresponding to system counter value. Used by + * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific * clocksource. */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 266d028..0ff065c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1232,11 +1232,12 @@ int get_device_system_crosststamp(int (*get_time_fn) return ret; /* - * Verify that the clocksource associated with the captured - * system counter value is the same as the currently installed - * timekeeper clocksource + * Verify that the clocksource ID associated with the captured + * system counter value is the same as for the currently + * installed timekeeper clocksource */ - if (tk->tkr_mono.clock != system_counterval.cs) + if (system_counterval.cs_id == CSID_GENERIC || + tk->tkr_mono.clock->id != system_counterval.cs_id) return -ENODEV; cycles = system_counterval.cycles;