All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Roger Pau Monné" <roger@xenproject.org>
Subject: [PATCH 07/13] x86/time: use domain_vcpu() in tsc_set_info()
Date: Thu, 26 Nov 2026 14:39:28 +0100	[thread overview]
Message-ID: <ca238147-e4bd-4928-b3a6-d4a8dacecf13@suse.com> (raw)
In-Reply-To: <1ea6d02b-8fba-4b1e-969c-033d6a7be233@suse.com>

If for nothing else, then to reduce the number of open-coded d->vcpu[]
accesses.

No functional change intended.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -3076,12 +3076,16 @@ int tsc_set_info(struct domain *d,
     d->arch.incarnation = incarnation + 1;
     if ( is_hvm_domain(d) )
     {
+        struct vcpu *v;
+
         if ( hvm_tsc_scaling_supported && !d->arch.vtsc )
             d->arch.hvm.tsc_scaling_ratio =
                 hvm_get_tsc_scaling_ratio(d->arch.tsc_khz);
 
         hvm_set_rdtsc_exiting(d, d->arch.vtsc);
-        if ( d->vcpu && d->vcpu[0] && incarnation == 0 )
+
+        v = domain_vcpu(d, 0);
+        if ( v && !incarnation )
         {
             /*
              * set_tsc_offset() is called from hvm_vcpu_initialise() before
@@ -3092,8 +3096,7 @@ int tsc_set_info(struct domain *d,
              * will sync their TSC to BSP's sync_tsc.
              */
             d->arch.hvm.sync_tsc = rdtsc();
-            hvm_set_tsc_offset(d->vcpu[0],
-                               d->vcpu[0]->arch.hvm.cache_tsc_offset);
+            hvm_set_tsc_offset(v, v->arch.hvm.cache_tsc_offset);
         }
     }
 



  parent reply	other threads:[~2026-11-26 13:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 12:48 [PATCH 00/13] make better use of domain_vcpu() Jan Beulich
2026-11-26 13:35 ` [PATCH 01/13] x86/gdbsx: don't blindly assume vCPU 0 exists Jan Beulich
2026-11-26 13:36 ` [PATCH 02/13] x86/passthrough: don't blindly assume vCPU-s exist Jan Beulich
2026-11-26 13:37 ` [PATCH 03/13] x86/altp2m: " Jan Beulich
2026-12-02  6:38   ` Stephen Cheng
2026-12-02  7:41     ` Jan Beulich
2026-11-26 13:37 ` [PATCH 04/13] domctl: use domain_vcpu() in XEN_DOMCTL_{g,s}etvcpucontext handling Jan Beulich
2026-11-26 13:38 ` [PATCH 05/13] vm-event: use domain_vcpu() in domctl handling Jan Beulich
2026-11-26 13:38 ` [PATCH 06/13] numa: use domain_vcpu() in domain_to_node() Jan Beulich
2026-11-26 13:39 ` Jan Beulich [this message]
2026-11-26 13:39 ` [PATCH 08/13] x86/paging: use domain_vcpu() in paging_domctl() Jan Beulich
2026-11-26 13:40 ` [PATCH 09/13] x86/dm: use domain_vcpu() Jan Beulich
2026-11-26 13:41 ` [PATCH 10/13] x86/HVM/MTRR: " Jan Beulich
2026-11-26 13:41 ` [PATCH 11/13] x86/HVM: introduce hvm_load_vcpu_instance() Jan Beulich
2026-11-26 13:43   ` Jan Beulich
2026-11-26 13:42 ` [PATCH 12/13] x86/vPMU: use domain_vcpu() Jan Beulich
2026-11-26 13:42 ` [PATCH 13/13] x86/domctl: use domain_vcpu() to handle various sub-ops Jan Beulich
2026-12-02  6:32 ` [PATCH 00/13] make better use of domain_vcpu() Stephen Cheng
2026-12-02  7:34   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca238147-e4bd-4928-b3a6-d4a8dacecf13@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger@xenproject.org \
    --cc=teddy.astie@vates.tech \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.