[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5501f2a-ff8d-cea2-1540-1a70ea6bc2d2@redhat.com>
Date: Wed, 8 Jan 2020 13:43:51 +0100
From: David Hildenbrand <david@...hat.com>
To: Logan Gunthorpe <logang@...tatee.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-ia64@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-s390@...r.kernel.org, linux-sh@...r.kernel.org,
platform-driver-x86@...r.kernel.org, linux-mm@...ck.org,
Dan Williams <dan.j.williams@...el.com>,
Michal Hocko <mhocko@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Christoph Hellwig <hch@....de>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Eric Badger <ebadger@...aio.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ibm.com>
Subject: Re: [PATCH v2 6/8] s390/mm: Thread pgprot_t through
vmem_add_mapping()
On 07.01.20 21:59, Logan Gunthorpe wrote:
> In prepartion to support a pgprot_t argument for arch_add_memory().
>
> Cc: Heiko Carstens <heiko.carstens@...ibm.com>
> Cc: Vasily Gorbik <gor@...ux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@...ibm.com>
> Signed-off-by: Logan Gunthorpe <logang@...tatee.com>
> ---
> arch/s390/include/asm/pgtable.h | 3 ++-
> arch/s390/mm/extmem.c | 3 ++-
> arch/s390/mm/init.c | 2 +-
> arch/s390/mm/vmem.c | 10 +++++-----
> 4 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 7b03037a8475..e667a1a96879 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -1640,7 +1640,8 @@ static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset)
>
> #define kern_addr_valid(addr) (1)
>
> -extern int vmem_add_mapping(unsigned long start, unsigned long size);
> +extern int vmem_add_mapping(unsigned long start, unsigned long size,
> + pgprot_t prot);
> extern int vmem_remove_mapping(unsigned long start, unsigned long size);
> extern int s390_enable_sie(void);
> extern int s390_enable_skey(void);
> diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
> index fd0dae9d10f4..6cf7029a7b35 100644
> --- a/arch/s390/mm/extmem.c
> +++ b/arch/s390/mm/extmem.c
> @@ -313,7 +313,8 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
> goto out_free;
> }
>
> - rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
> + rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1,
> + PAGE_KERNEL);
>
> if (rc)
> goto out_free;
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index a0c88c1c9ad0..ef19522ddad2 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -277,7 +277,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
> if (WARN_ON_ONCE(modifiers->altmap))
> return -EINVAL;
>
> - rc = vmem_add_mapping(start, size);
> + rc = vmem_add_mapping(start, size, PAGE_KERNEL);
> if (rc)
> return rc;
>
> diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
> index b403fa14847d..8a5e95f184a2 100644
> --- a/arch/s390/mm/vmem.c
> +++ b/arch/s390/mm/vmem.c
> @@ -66,7 +66,7 @@ pte_t __ref *vmem_pte_alloc(void)
> /*
> * Add a physical memory range to the 1:1 mapping.
> */
> -static int vmem_add_mem(unsigned long start, unsigned long size)
> +static int vmem_add_mem(unsigned long start, unsigned long size, pgprot_t prot)
> {
> unsigned long pgt_prot, sgt_prot, r3_prot;
> unsigned long pages4k, pages1m, pages2g;
> @@ -79,7 +79,7 @@ static int vmem_add_mem(unsigned long start, unsigned long size)
> pte_t *pt_dir;
> int ret = -ENOMEM;
>
> - pgt_prot = pgprot_val(PAGE_KERNEL);
> + pgt_prot = pgprot_val(prot);
> sgt_prot = pgprot_val(SEGMENT_KERNEL);
> r3_prot = pgprot_val(REGION3_KERNEL);
So, if we map as huge/gigantic pages, the protection would be discarded?
That looks wrong.
s390x does not support ZONE_DEVICE yet. Maybe simply bail out for s390x
as you do for sh to make your life easier?
[...]
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists