[lkml]   [2017]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 06/23] x86, kaiser: introduce user-mapped percpu areas
On Tue, 31 Oct 2017, Dave Hansen wrote:

> These patches are based on work from a team at Graz University of
> Technology posted here:
> The KAISER approach keeps two copies of the page tables: one for running
> in the kernel and one for running userspace. But, there are a few
> structures that are needed for switching in and out of the kernel and
> a good subset of *those* are per-cpu data.
> This patch creates a new kind of per-cpu data that is mapped and can be
> used no matter which copy of the page tables we are using.

Please split out the percpu-defs.h change into a seperate patch.

> -DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
> +DECLARE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(struct gdt_page, gdt_page);


> /* Provide the original GDT */
> static inline struct desc_struct *get_cpu_gdt_rw(unsigned int cpu)
> diff -puN arch/x86/include/asm/hw_irq.h~kaiser-prep-user-mapped-percpu arch/x86/include/asm/hw_irq.h
> --- a/arch/x86/include/asm/hw_irq.h~kaiser-prep-user-mapped-percpu 2017-10-31 15:03:51.048146366 -0700
> +++ b/arch/x86/include/asm/hw_irq.h 2017-10-31 15:03:51.066147217 -0700
> @@ -160,7 +160,7 @@ extern char irq_entries_start[];
> #define VECTOR_RETRIGGERED ((void *)~0UL)
> typedef struct irq_desc* vector_irq_t[NR_VECTORS];
> -DECLARE_PER_CPU(vector_irq_t, vector_irq);
> +DECLARE_PER_CPU_USER_MAPPED(vector_irq_t, vector_irq);

Why? The vector_irq array has nothing to do with user space. It's a
software handled storage which is used in the irq dispatcher way after the
exception entry happened.

I think you confused that with the IDT, which is missing here.

> -DECLARE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss);
> +DECLARE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct tss_struct, cpu_tss);


> -DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
> +DEFINE_PER_CPU_PAGE_ALIGNED_USER_MAPPED(struct gdt_page, gdt_page) = { .gdt = {


> -static DEFINE_PER_CPU_PAGE_ALIGNED(char, exception_stacks

Hmm. I don't think that's a good idea. We discussed that in Prague with
Andy and the Peters and came to the conclusion that we want a stub stack in
the user mapping and switch to the kernel stacks in software after
switching back to the kernel mappings. Andys 'Pile o' entry...' series
paves the way to that already. So can we please put kaiser on top of those
and do it proper right away?

> -DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
> +DEFINE_PER_CPU_USER_MAPPED(vector_irq_t, vector_irq) = {
> };

See above.



 \ /
  Last update: 2017-11-01 22:48    [W:0.406 / U:0.324 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site