From nobody Wed Dec 4 18:53:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725368635; cv=none; d=zohomail.com; s=zohoarc; b=Ro+NA+acPiig5jtK0YK8HLFelfdq9qN4lo67N2rELxWkrO3O/P1pWzkQHbtWZi0+2oWQCl2Vomuz+zd3k5dYoIT+HM1t3hM4U0n9+1Ui0rxDUO1nqhY8Yqv3D5BvDaDVuKic8xgJfgusNYij3B6u+6LXYYDC6m40zjeea+YFRDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725368635; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wlZbFmrpXgN45+AwQZrxSvY5k9Jof+k8TfRDS2/g8Jk=; b=mq8tqjHkGjawH5FbfwEjPMmVUx5uHevKgL8/9AY6Fj/0U+g/3XUXEEZX+APnikAdRGnlJYwfbCwJTRyDb04Va/F+ZXkbXm9q+ZafXzff8K6ByKsjLCFxp8V8aax5lzs8+xIn77qIEqmRY1zXaUJ/cLJFjy6uw+se07VRcDgLoFY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725368635811492.41797966926947; Tue, 3 Sep 2024 06:03:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.789154.1198726 (Exim 4.92) (envelope-from ) id 1slTC1-0000N1-Vc; Tue, 03 Sep 2024 13:03:33 +0000 Received: by outflank-mailman (output) from mailman id 789154.1198726; Tue, 03 Sep 2024 13:03:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slTC1-0000Mj-S9; Tue, 03 Sep 2024 13:03:33 +0000 Received: by outflank-mailman (input) for mailman id 789154; Tue, 03 Sep 2024 13:03:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slTC0-0006aM-6o for xen-devel@lists.xenproject.org; Tue, 03 Sep 2024 13:03:32 +0000 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [2a00:1450:4864:20::429]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eac49aed-69f4-11ef-99a1-01e77a169b0f; Tue, 03 Sep 2024 15:03:30 +0200 (CEST) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-374c3400367so2022676f8f.2 for ; Tue, 03 Sep 2024 06:03:30 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42c88c624f7sm29018635e9.39.2024.09.03.06.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 06:03:28 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eac49aed-69f4-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725368609; x=1725973409; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wlZbFmrpXgN45+AwQZrxSvY5k9Jof+k8TfRDS2/g8Jk=; b=YZdDFskrdpci6NJY8E+zzQBhJxRogIg1egGtmtrHCSQk1mnSaHfq4GOp3kJuqA9VNT NoZESqRwZpX264TkXc6iSY0BsE9pktilj/BGr1hFed1I80U5bkXJma00eZ4n3HD5zl5z 9PFJTEFZgGoGuc3SL+7IvLL9W8zw36149RQW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725368609; x=1725973409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wlZbFmrpXgN45+AwQZrxSvY5k9Jof+k8TfRDS2/g8Jk=; b=ETBSf9BQDv5OREtJbkphWCpYfhH/Dm/8nyxryrq+5pw/SjyXzARTahOw9IpohlraL/ ylJdG0u/Q3t8uH4AIaZTaVlvFQqqFXlvuQD02gQtvnhNG6GfdFupi6dSMHaDqxrf/a6l T9waZsQMdP5wTxRUCFCJpluApngSaupHYL6sJ5qTlT+dEXHpbzFq05PFzBWD5cLN/bR/ F9hFiu9rGFE8OsWiydzu1MNjqdQsq1GkqtJ7g0iXuJJfdxuX7e+cNwqfTPnZfK443mBb OaVOHN2vuIBq3t6MDtt4pAQQ6VRrWhSj4TZutyY6BnlKPHFLx/vbMhT7+M+ohzaqPg38 oyaA== X-Gm-Message-State: AOJu0YyoflWBHNqC9Qc+QO/L4UJfXYP/OtJEIC4ZbR6TGI8Z9UAa6Lgq wQoyLykkO5P0b0HvcYIa61lNDBGf0Gp+lw9tg4BdmaYxGAO9QoBb7PTZdTKqRdxtC4My/Qf58C1 S X-Google-Smtp-Source: AGHT+IE8qegNxXDlJK1PFWwHLcnJqhDb4R6QI089xcWKPngT9LyUKz+TVPUn4HkmSxtmlDjANTWxQA== X-Received: by 2002:a5d:64e4:0:b0:374:c3e4:d6b1 with SMTP id ffacd0b85a97d-374c3e4d794mr8638205f8f.44.1725368609090; Tue, 03 Sep 2024 06:03:29 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Roger Pau Monne , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v3 6/7] x86/time: introduce command line option to select wallclock Date: Tue, 3 Sep 2024 15:03:02 +0200 Message-ID: <20240903130303.71334-7-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240903130303.71334-1-roger.pau@citrix.com> References: <20240903130303.71334-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725368637372116600 Allow setting the used wallclock from the command line. When the option is= set to a value different than `auto` the probing is bypassed and the selected implementation is used (as long as it's available). The `xen` and `efi` options require being booted as a Xen guest (with Xen g= uest supported built-in) or from UEFI firmware. Signed-off-by: Roger Pau Monn=C3=A9 --- docs/misc/xen-command-line.pandoc | 18 +++++++++++++++++ xen/arch/x86/time.c | 33 ++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 0a66e1ee2d7e..23de922b9705 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2821,6 +2821,24 @@ vwfi to `native` reduces irq latency significantly. = It can also lead to suboptimal scheduling decisions, but only when the system is oversubscribed (i.e., in total there are more vCPUs than pCPUs). =20 +### wallclock (x86) +> `=3D auto |=C2=A0xen | cmos | efi` + +> Default: `auto` + +Allow forcing the usage of a specific wallclock source. + + * `auto` let the hypervisor select the clocksource based on internal + heuristics. + + * `xen` force usage of the Xen shared_info wallclock when booted as a Xen + guest. + + * `cmos` force usage of the CMOS RTC wallclock. + + * `efi` force usage of the EFI_GFET_TIME run-time method when booted from= EFI + firmware. + ### watchdog (x86) > `=3D force | ` =20 diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index da3fd1555041..6e19c666d13f 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1555,6 +1555,36 @@ static const char *wallclock_type_to_string(void) return ""; } =20 +static int __init cf_check parse_wallclock(const char *arg) +{ + if ( !arg ) + return -EINVAL; + + if ( !strcmp("auto", arg) ) + wallclock_source =3D WALLCLOCK_UNSET; + else if ( !strcmp("xen", arg) ) + { + if ( !xen_guest ) + return -EINVAL; + + wallclock_source =3D WALLCLOCK_XEN; + } + else if ( !strcmp("cmos", arg) ) + wallclock_source =3D WALLCLOCK_CMOS; + else if ( !strcmp("efi", arg) ) + { + if ( !efi_enabled(EFI_RS) ) + return -EINVAL; + + wallclock_source =3D WALLCLOCK_EFI; + } + else + return -EINVAL; + + return 0; +} +custom_param("wallclock", parse_wallclock); + static void __init probe_wallclock(void) { ASSERT(wallclock_source =3D=3D WALLCLOCK_UNSET); @@ -2527,7 +2557,8 @@ int __init init_xen_time(void) =20 open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration); =20 - probe_wallclock(); + if ( wallclock_source =3D=3D WALLCLOCK_UNSET ) + probe_wallclock(); =20 printk(XENLOG_INFO "Wallclock source: %s\n", wallclock_type_to_string(= )); =20 --=20 2.46.0