From nobody Wed Dec 4 19:03:53 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=1725463950; cv=none; d=zohomail.com; s=zohoarc; b=PH7jO3B3W/m2BgbxqfF3N9hbKGeqWiP/Kdbs0CqyWiRvveU/rsdF7QS0nP6FhS5E/6I7GY4lnyXAaPr2NWrsm0vbDk9JYeM667z+Lk+DUH1GK1XH+s70CYCOj+AqsIOi5eVQ1QQuBn4UJ6krie/lBh2mFszz5sgp0GQXmfFxBt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725463950; 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=wttwru9ZqE1vNc2cTpVoP3TJEtmOujc6puRAfHnBzQg=; b=Hv+855R6zY/VqIqmjKoxgsJmpSy5MZadU3pqIwa7oild7CjTzpGUmHWCPzjrax2Z2gFP+JKGF+Gx1GJRDNuc9orjBXxBtD6sEUuJUPUBjIxPrauVRCIi4bVcext1VWm5WKwcwacXeeWlYpetTb0XL4veRSI19S/IRw9mzuwH484= 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 1725463950596221.52447966830323; Wed, 4 Sep 2024 08:32:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.790496.1200308 (Exim 4.92) (envelope-from ) id 1slrzM-0004o7-99; Wed, 04 Sep 2024 15:32:08 +0000 Received: by outflank-mailman (output) from mailman id 790496.1200308; Wed, 04 Sep 2024 15:32:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slrzM-0004ms-2V; Wed, 04 Sep 2024 15:32:08 +0000 Received: by outflank-mailman (input) for mailman id 790496; Wed, 04 Sep 2024 15:32:07 +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 1slrzL-0003Va-Ft for xen-devel@lists.xenproject.org; Wed, 04 Sep 2024 15:32:07 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d727354a-6ad2-11ef-99a1-01e77a169b0f; Wed, 04 Sep 2024 17:32:05 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a869332c2c2so158324966b.0 for ; Wed, 04 Sep 2024 08:32:05 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a623a45b0sm5548066b.143.2024.09.04.08.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 08:32:03 -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: d727354a-6ad2-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725463924; x=1726068724; 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=wttwru9ZqE1vNc2cTpVoP3TJEtmOujc6puRAfHnBzQg=; b=SON+06av0Y+pV3xgXeZt1LHeH0uJbFre9BoYGCikFEpIV1zkDXhKOZwRKBoRmTxwz4 dvy1674C4Afs+OrI0fnwaAtIHFNZ529i9XwlXW3Ds2bmLgxSFtvzF5y6FcRNoc8LCpmQ SrqSLQhtKY4776cVKuY2ica4JBrwpQknlWUog= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725463924; x=1726068724; 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=wttwru9ZqE1vNc2cTpVoP3TJEtmOujc6puRAfHnBzQg=; b=s6LKgZ28lwBx4zKC+5bUi1Nop4j/OIAc2n15AZCPM3w9Z3TYbP3sX2pIoq30C1qYFk Iwi/yc6797bDBAvbSG3CRYNhywS34Nqpxwu5W/3BnKcSmsV19nmrLnZeinb4dSBHjzu+ XsuXp89NzSLCcmybp0zQGCCwjDHlRxYhIcH+4wgPbFA3Dmv+4pTbMc9J+s1VZC9HZmIn UM4MTwzGJIoY0DLypwUQsJgGGsUvs6uxkuhfz43P4Anjj2opkxfhDiUWrr1/xNlYIG/J NMdE/B4uz0f085t6juzxYLAn5e7p3q+Cl/2O79VbL5aG6lVjLE4bisak7zWXIw1RTJ4u 6qnQ== X-Gm-Message-State: AOJu0Yx8jv/cz6usBSLtTyvaO9sQ2fTvn5LxkbDLBP2odK7WbvwmmC02 1IJl+FPVcNIND1CiAB4sx8gwxb4hTh26w1zgs7+FNskxicWz4Y1QV/USGh6oWV/YsM/B9KJkwmN i X-Google-Smtp-Source: AGHT+IFBzXdkAuKaYu8oiD2UdSN5m8OT1z+hLba5AKJcLQo1M7yXW9aHY2tJl8+iVLfn1VeR7WUnCg== X-Received: by 2002:a17:907:7f14:b0:a7a:8284:c8d6 with SMTP id a640c23a62f3a-a8a43140f0emr268958966b.24.1725463924379; Wed, 04 Sep 2024 08:32:04 -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 v4 5/6] x86/time: introduce command line option to select wallclock Date: Wed, 4 Sep 2024 17:31:50 +0200 Message-ID: <20240904153151.83995-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240904153151.83995-1-roger.pau@citrix.com> References: <20240904153151.83995-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: 1725463952371116600 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 --- Changes since v3: - Note xen option is only available if Xen guest support it built. - Fix typo. --- docs/misc/xen-command-line.pandoc | 19 ++++++++++++++++++ xen/arch/x86/time.c | 33 ++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 0a66e1ee2d7e..1944b9d8eb9d 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2821,6 +2821,25 @@ 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. This option is only available if the hypervisor was compiled wi= th + `CONFIG_XEN_GUEST` enabled. + + * `cmos` force usage of the CMOS RTC wallclock. + + * `efi` force usage of the EFI_GET_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 9ebeee61b987..52944b8fbfde 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1553,6 +1553,36 @@ static const char *__init wallclock_type_to_string(v= oid) 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); @@ -2528,7 +2558,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