public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman•id.au>
To: Balbir Singh <bsingharora@gmail•com>
Cc: linuxppc-dev <linuxppc-dev@ozlabs•org>,
	Aneesh Kumar KV <aneesh.kumar@linux•vnet.ibm.com>,
	Paul Mackerras  <paulus@samba•org>
Subject: Re: [PATCH] powerpc/mm/radix: Only add X for pages overlapping kernel text
Date: Tue, 06 Jun 2017 20:17:02 +1000	[thread overview]
Message-ID: <87zidlpgip.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <CAKTCnzmUPUBP_NQjzcUO_z+iVtn_ArwHpzWToGYvQVV-zjoB7w@mail.gmail.com>

Balbir Singh <bsingharora@gmail•com> writes:
> On Tue, Jun 6, 2017 at 3:48 PM, Michael Ellerman <mpe@ellerman•id.au> wrote:
>> Currently we map the whole linear mapping with PAGE_KERNEL_X. Instead we
>> should check if the page overlaps the kernel text and only then add
>> PAGE_KERNEL_X.
...
>> @@ -145,8 +147,14 @@ static int __meminit create_physical_mapping(unsigned long start,
>>                         start = addr;
>>                 }
>>
>> -               rc = radix__map_kernel_page((unsigned long)__va(addr), addr,
>> -                                           PAGE_KERNEL_X, mapping_size);
>> +               vaddr = (unsigned long)__va(addr);
>> +
>> +               if (overlaps_kernel_text(vaddr, vaddr + mapping_size))
>> +                       prot = PAGE_KERNEL_X;
>> +               else
>> +                       prot = PAGE_KERNEL;
>
> Do we need the kvm tmp/trampoline bits like hash?

Ugh, I hope not. What is that crap.

It appears to be epapr paravirt only:

  static int __init kvm_guest_init(void)
  {
  	if (!kvm_para_available())
  		goto free_tmp;
  
  	if (!epapr_paravirt_enabled)
  		goto free_tmp;


But I can't convince myself whether epapr_paravirt_enabled is ever set
on Book3S guests or not.

Looking at Qemu it looks like it *could* be.

And why isn't that code in arch/powerpc/kvm ?

cheers

  reply	other threads:[~2017-06-06 10:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  5:48 [PATCH] powerpc/mm/radix: Only add X for pages overlapping kernel text Michael Ellerman
2017-06-06  6:03 ` Balbir Singh
2017-06-06 10:17   ` Michael Ellerman [this message]
2017-06-08  7:49     ` Balbir Singh
2017-06-08  7:00 ` Aneesh Kumar K.V
2017-06-19 12:25 ` Michael Ellerman

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=87zidlpgip.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman$(echo .)id.au \
    --cc=aneesh.kumar@linux$(echo .)vnet.ibm.com \
    --cc=bsingharora@gmail$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox