All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular
@ 2019-07-02 12:48 Jan Beulich
  2019-07-02 13:01 ` Juergen Gross
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2019-07-02 12:48 UTC (permalink / raw)
  To: Juergen Gross, Andrew Cooper; +Cc: xen-devel, Wei Liu, Roger Pau Monné

>>> On 28.05.19 at 12:32, <jgross@suse.com> wrote:
> In preparation for core scheduling carve out the GDT related
> functionality (writing GDT related PTEs, loading default of full GDT)
> into sub-functions.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> ---
> RFC V2: split off non-refactoring part
> V1: constify pointers, use initializers (Jan Beulich)

I'm getting the impression that this and the following patch are
independent of the earlier parts of the series, and hence could
in principle go in right away? Am I overlooking anything?

Andrew, objections?

Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular
  2019-07-02 12:48 [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular Jan Beulich
@ 2019-07-02 13:01 ` Juergen Gross
  0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2019-07-02 13:01 UTC (permalink / raw)
  To: Jan Beulich, Andrew Cooper; +Cc: xen-devel, Wei Liu, Roger Pau Monné

On 02.07.19 14:48, Jan Beulich wrote:
>>>> On 28.05.19 at 12:32, <jgross@suse.com> wrote:
>> In preparation for core scheduling carve out the GDT related
>> functionality (writing GDT related PTEs, loading default of full GDT)
>> into sub-functions.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> RFC V2: split off non-refactoring part
>> V1: constify pointers, use initializers (Jan Beulich)
> 
> I'm getting the impression that this and the following patch are
> independent of the earlier parts of the series, and hence could
> in principle go in right away? Am I overlooking anything?

No, should work. Patches apply and the result shows no compiling errors.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular
  2019-05-28 10:32   ` Juergen Gross
@ 2019-07-02 15:38     ` Andrew Cooper
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2019-07-02 15:38 UTC (permalink / raw)
  To: Juergen Gross, xen-devel; +Cc: Wei Liu, Jan Beulich, Roger Pau Monné

Subject "load of the GDT"

On 28/05/2019 11:32, Juergen Gross wrote:
> In preparation for core scheduling carve out the GDT related

"for core scheduling, carve"

> functionality (writing GDT related PTEs, loading default of full GDT)
> into sub-functions.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
> ---
> RFC V2: split off non-refactoring part
> V1: constify pointers, use initializers (Jan Beulich)
> ---
>  xen/arch/x86/domain.c | 57 +++++++++++++++++++++++++++++++--------------------
>  1 file changed, 35 insertions(+), 22 deletions(-)
>
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index d3ee699da6..adc06154ee 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -1626,6 +1626,37 @@ static inline bool need_full_gdt(const struct domain *d)
>      return is_pv_domain(d) && !is_idle_domain(d);
>  }
>  
> +static inline void write_full_gdt_ptes(seg_desc_t *gdt, const struct vcpu *v)

We typically don't use inline for local static functions.

All can be fixed on commit.  Acked-by: Andrew Cooper
<andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular
@ 2019-05-28 10:32   ` Juergen Gross
  2019-07-02 15:38     ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Juergen Gross @ 2019-05-28 10:32 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monné

In preparation for core scheduling carve out the GDT related
functionality (writing GDT related PTEs, loading default of full GDT)
into sub-functions.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
RFC V2: split off non-refactoring part
V1: constify pointers, use initializers (Jan Beulich)
---
 xen/arch/x86/domain.c | 57 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d3ee699da6..adc06154ee 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1626,6 +1626,37 @@ static inline bool need_full_gdt(const struct domain *d)
     return is_pv_domain(d) && !is_idle_domain(d);
 }
 
+static inline void write_full_gdt_ptes(seg_desc_t *gdt, const struct vcpu *v)
+{
+    unsigned long mfn = virt_to_mfn(gdt);
+    l1_pgentry_t *pl1e = pv_gdt_ptes(v);
+    unsigned int i;
+
+    for ( i = 0; i < NR_RESERVED_GDT_PAGES; i++ )
+        l1e_write(pl1e + FIRST_RESERVED_GDT_PAGE + i,
+                  l1e_from_pfn(mfn + i, __PAGE_HYPERVISOR_RW));
+}
+
+static inline void load_full_gdt(const struct vcpu *v, unsigned int cpu)
+{
+    struct desc_ptr gdt_desc = {
+        .limit = LAST_RESERVED_GDT_BYTE,
+        .base = GDT_VIRT_START(v),
+    };
+
+    lgdt(&gdt_desc);
+}
+
+static inline void load_default_gdt(const seg_desc_t *gdt, unsigned int cpu)
+{
+    struct desc_ptr gdt_desc = {
+        .limit = LAST_RESERVED_GDT_BYTE,
+        .base  = (unsigned long)(gdt - FIRST_RESERVED_GDT_ENTRY),
+    };
+
+    lgdt(&gdt_desc);
+}
+
 static void __context_switch(void)
 {
     struct cpu_user_regs *stack_regs = guest_cpu_user_regs();
@@ -1634,7 +1665,6 @@ static void __context_switch(void)
     struct vcpu          *n = current;
     struct domain        *pd = p->domain, *nd = n->domain;
     seg_desc_t           *gdt;
-    struct desc_ptr       gdt_desc;
 
     ASSERT(p != n);
     ASSERT(!vcpu_cpu_dirty(n));
@@ -1676,25 +1706,13 @@ static void __context_switch(void)
 
     gdt = !is_pv_32bit_domain(nd) ? per_cpu(gdt_table, cpu) :
                                     per_cpu(compat_gdt_table, cpu);
-    if ( need_full_gdt(nd) )
-    {
-        unsigned long mfn = virt_to_mfn(gdt);
-        l1_pgentry_t *pl1e = pv_gdt_ptes(n);
-        unsigned int i;
 
-        for ( i = 0; i < NR_RESERVED_GDT_PAGES; i++ )
-            l1e_write(pl1e + FIRST_RESERVED_GDT_PAGE + i,
-                      l1e_from_pfn(mfn + i, __PAGE_HYPERVISOR_RW));
-    }
+    if ( need_full_gdt(nd) )
+        write_full_gdt_ptes(gdt, n);
 
     if ( need_full_gdt(pd) &&
          ((p->vcpu_id != n->vcpu_id) || !need_full_gdt(nd)) )
-    {
-        gdt_desc.limit = LAST_RESERVED_GDT_BYTE;
-        gdt_desc.base  = (unsigned long)(gdt - FIRST_RESERVED_GDT_ENTRY);
-
-        lgdt(&gdt_desc);
-    }
+        load_default_gdt(gdt, cpu);
 
     write_ptbase(n);
 
@@ -1707,12 +1725,7 @@ static void __context_switch(void)
 
     if ( need_full_gdt(nd) &&
          ((p->vcpu_id != n->vcpu_id) || !need_full_gdt(pd)) )
-    {
-        gdt_desc.limit = LAST_RESERVED_GDT_BYTE;
-        gdt_desc.base = GDT_VIRT_START(n);
-
-        lgdt(&gdt_desc);
-    }
+        load_full_gdt(n, cpu);
 
     if ( pd != nd )
         cpumask_clear_cpu(cpu, pd->dirty_cpumask);
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-02 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02 12:48 [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular Jan Beulich
2019-07-02 13:01 ` Juergen Gross
  -- strict thread matches above, loose matches on Subject: below --
2019-05-28 10:32 [PATCH 00/60] xen: add core scheduling support Juergen Gross
2019-05-28 10:32 ` [Xen-devel] [PATCH 38/60] x86: make loading of GDT at context switch more modular Juergen Gross
2019-05-28 10:32   ` Juergen Gross
2019-07-02 15:38     ` Andrew Cooper

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.