From nobody Mon Feb 9 15:10:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565363925; cv=none; d=zoho.com; s=zohoarc; b=XuU+4A+yd4ug/7e8V/Q5ZP6aa59IN3+fFAp67uhUVctNk5Ku5jssGYiFoXbDBIof2rL5DetHeG4o4Vn1zkPMFjMlH4l9Le075vRP6aZ5ixyuArv5TKYZZCs97yQVEESKPtRM+7ThHTsPFMpyZ7/tE9RzgxmEKgUClHv3Knrm5oE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565363925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ImFjdmnlv7ZJcbl1miJoFqaqQADOHylHEdTGxaGtSCc=; b=L1Y8mjXGvuJOrzDhHixfaw1z3F7NmDlY30ipzUFzCIKZQkGHgHng+2yB67Yp/smlPLXD+WSOH/VyUUfon5SYSiiglezC7oULV0LC590HGaiInS0WO0QojSJ88gxgYNIkyMftH50eRPYliU3JzLzwiUIhkLFu+A0yRq0M5dUV8Ks= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1565363925181204.81200063497897; Fri, 9 Aug 2019 08:18:45 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6du-0005EE-Ut; Fri, 09 Aug 2019 15:17:22 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6du-0005E9-6Q for xen-devel@lists.xenproject.org; Fri, 09 Aug 2019 15:17:22 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c84489d2-bab8-11e9-8980-bc764e045a96; Fri, 09 Aug 2019 15:17:21 +0000 (UTC) X-Inumbo-ID: c84489d2-bab8-11e9-8980-bc764e045a96 Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AsYDZb1t9tCnb1SzAEnd+2PCSKMzFAH0s4zft2cmvhBpVHDQyDqBacaiz1Xf2psrZswi6o5D+n 4yM6TeedP3YnFS5UMm75M76CkOlENQYUNF3sVL1rOkiVn5MXX6LVIez8zOK75o+NKj2MPR9D/S QfKLl4Tv0NaulvJBwxiIJOwKqn6D8YTOS1isnJxG0B4F5TLS7G5am3S9cZ9wuDljiBwbbxCJdg aC5QjG3uL3SoAXBxqwG5M25NN1tQvXnkQDIO3dvXbhZL5J0RgqnXDjHYsRYkxSeYhwTp9LwsQh GBc= X-SBRS: 2.7 X-MesageID: 4253645 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,364,1559534400"; d="scan'208";a="4253645" From: Andrew Cooper To: Xen-devel Date: Fri, 9 Aug 2019 16:17:17 +0100 Message-ID: <20190809151717.12471-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v4 3/2] x86: Clean up TSS types and variable names X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The _struct suffix on tss_struct is quite redundant. Rename it to tss64 to mirror the existing tss32 structure we have in HVM's Task Switch logic. The per-cpu name having an init_ prefix is also wrong. There is exactly one TSS for each CPU, which is used for the lifetime of the system. Drop the redirection and update all callers to use tss_page properly. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 RFC, and based on my requested changes for patch 2. --- xen/arch/x86/cpu/common.c | 8 ++++---- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/smpboot.c | 2 +- xen/arch/x86/traps.c | 8 ++++---- xen/include/asm-x86/processor.h | 5 ++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index dc2dea4d6d..797d970d9a 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -707,7 +707,7 @@ void load_system_tables(void) unsigned long stack_bottom =3D get_stack_bottom(), stack_top =3D stack_bottom & ~(STACK_SIZE - 1); =20 - struct tss_struct *tss =3D &this_cpu(init_tss); + struct tss64 *tss =3D &this_cpu(tss_page).tss; seg_desc_t *gdt =3D this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY; seg_desc_t *compat_gdt =3D @@ -722,7 +722,7 @@ void load_system_tables(void) .limit =3D (IDT_ENTRIES * sizeof(idt_entry_t)) - 1, }; =20 - *tss =3D (struct tss_struct){ + *tss =3D (struct tss64){ /* Main stack for interrupts/exceptions. */ .rsp0 =3D stack_bottom, =20 @@ -750,12 +750,12 @@ void load_system_tables(void) _set_tssldt_desc( gdt + TSS_ENTRY, (unsigned long)tss, - offsetof(struct tss_struct, __cacheline_filler) - 1, + offsetof(struct tss64, __cacheline_filler) - 1, SYS_DESC_tss_avail); _set_tssldt_desc( compat_gdt + TSS_ENTRY, (unsigned long)tss, - offsetof(struct tss_struct, __cacheline_filler) - 1, + offsetof(struct tss64, __cacheline_filler) - 1, SYS_DESC_tss_busy); =20 per_cpu(full_gdt_loaded, cpu) =3D false; diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 098613822a..c438befe35 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -796,7 +796,7 @@ static void vmx_set_host_env(struct vcpu *v) (unsigned long)(this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY)); __vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]); =20 - __vmwrite(HOST_TR_BASE, (unsigned long)&per_cpu(init_tss, cpu)); + __vmwrite(HOST_TR_BASE, (unsigned long)&per_cpu(tss_page, cpu).tss); =20 __vmwrite(HOST_SYSENTER_ESP, get_stack_bottom()); =20 diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 8d5fef0012..4833891bda 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -825,7 +825,7 @@ static int setup_cpu_root_pgt(unsigned int cpu) if ( !rc ) rc =3D clone_mapping(idt_tables[cpu], rpt); if ( !rc ) - rc =3D clone_mapping(&per_cpu(init_tss, cpu), rpt); + rc =3D clone_mapping(&per_cpu(tss_page, cpu).tss, rpt); if ( !rc ) rc =3D clone_mapping((void *)per_cpu(stubs.addr, cpu), rpt); =20 diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 252fe6d792..b143def51c 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -565,7 +565,7 @@ void show_stack_overflow(unsigned int cpu, const struct= cpu_user_regs *regs) =20 printk("Valid stack range: %p-%p, sp=3D%p, tss.rsp0=3D%p\n", (void *)esp_top, (void *)esp_bottom, (void *)esp, - (void *)per_cpu(init_tss, cpu).rsp0); + (void *)per_cpu(tss_page, cpu).tss.rsp0); =20 /* * Trigger overflow trace if %esp is anywhere within the guard page, or @@ -1903,7 +1903,7 @@ static void __init set_intr_gate(unsigned int n, void= *addr) =20 void load_TR(void) { - struct tss_struct *tss =3D &this_cpu(init_tss); + struct tss64 *tss =3D &this_cpu(tss_page).tss; struct desc_ptr old_gdt, tss_gdt =3D { .base =3D (long)(this_cpu(gdt) - FIRST_RESERVED_GDT_ENTRY), .limit =3D LAST_RESERVED_GDT_BYTE @@ -1912,12 +1912,12 @@ void load_TR(void) _set_tssldt_desc( this_cpu(gdt) + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY, (unsigned long)tss, - offsetof(struct tss_struct, __cacheline_filler) - 1, + offsetof(struct tss64, __cacheline_filler) - 1, SYS_DESC_tss_avail); _set_tssldt_desc( this_cpu(compat_gdt) + TSS_ENTRY - FIRST_RESERVED_GDT_ENTRY, (unsigned long)tss, - offsetof(struct tss_struct, __cacheline_filler) - 1, + offsetof(struct tss64, __cacheline_filler) - 1, SYS_DESC_tss_busy); =20 /* Switch to non-compat GDT (which has B bit clear) to execute LTR. */ diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processo= r.h index 6f180775f4..4c2710ca2b 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -411,7 +411,7 @@ static always_inline void __mwait(unsigned long eax, un= signed long ecx) #define IOBMP_BYTES 8192 #define IOBMP_INVALID_OFFSET 0x8000 =20 -struct __packed tss_struct { +struct __packed tss64 { uint32_t :32; uint64_t rsp0, rsp1, rsp2; uint64_t :64; @@ -426,10 +426,9 @@ struct __packed tss_struct { uint8_t __cacheline_filler[24]; }; struct tss_page { - struct tss_struct __aligned(PAGE_SIZE) tss; + struct tss64 __aligned(PAGE_SIZE) tss; }; DECLARE_PER_CPU(struct tss_page, tss_page); -#define per_cpu__init_tss get_per_cpu_var(tss_page.tss) =20 #define IST_NONE 0UL #define IST_DF 1UL --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel