* Re: [PATCH] x86: fix {pmd,pud}_{set,clear}_flags()
[not found] <5A8AF1BB02000078001A91C3@suse.com>
@ 2018-02-19 16:23 ` Juergen Gross
2018-02-19 17:04 ` Jan Beulich
[not found] ` <5A8B119F02000078001A9412@suse.com>
0 siblings, 2 replies; 4+ messages in thread
From: Juergen Gross @ 2018-02-19 16:23 UTC (permalink / raw)
To: Jan Beulich, Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: Boris Ostrovsky, lkml
On 19/02/18 15:48, Jan Beulich wrote:
> Just like pte_{set,clear}_flags() their PMD and PUD counterparts should
> not do any address translation. This was outright wrong under Xen
> (causing a dead boot with no useful output on "suitable" systems), and
> produced needlessly more complicated code (even if just slightly) when
> paravirt was enabled.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Cc: stable@vger.kernel.org
While the changes look alright I'm really curious which kind of failure
you are seeing, especially considering how long those functions haven't
been changed (since more than 6 years).
Juergen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: fix {pmd,pud}_{set,clear}_flags()
2018-02-19 16:23 ` [PATCH] x86: fix {pmd,pud}_{set,clear}_flags() Juergen Gross
@ 2018-02-19 17:04 ` Jan Beulich
[not found] ` <5A8B119F02000078001A9412@suse.com>
1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-02-19 17:04 UTC (permalink / raw)
To: Juergen Gross
Cc: Ingo Molnar, Thomas Gleixner, Boris Ostrovsky, lkml, H. Peter Anvin
>>> On 19.02.18 at 17:23, <jgross@suse.com> wrote:
> On 19/02/18 15:48, Jan Beulich wrote:
>> Just like pte_{set,clear}_flags() their PMD and PUD counterparts should
>> not do any address translation. This was outright wrong under Xen
>> (causing a dead boot with no useful output on "suitable" systems), and
>> produced needlessly more complicated code (even if just slightly) when
>> paravirt was enabled.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Cc: stable@vger.kernel.org
>
> While the changes look alright I'm really curious which kind of failure
> you are seeing, especially considering how long those functions haven't
> been changed (since more than 6 years).
It's the new use of pmd_set_flags() in 2cc42bac1c ("x86-64/Xen:
eliminate W+X mappings"), and due to the (very odd afaic) identity
map handling the issue is invisible on most systems/setups.
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: fix {pmd,pud}_{set,clear}_flags()
[not found] ` <5A8B119F02000078001A9412@suse.com>
@ 2018-02-19 17:41 ` Juergen Gross
0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-02-19 17:41 UTC (permalink / raw)
To: Jan Beulich
Cc: Ingo Molnar, Thomas Gleixner, Boris Ostrovsky, lkml, H. Peter Anvin
On 19/02/18 18:04, Jan Beulich wrote:
>>>> On 19.02.18 at 17:23, <jgross@suse.com> wrote:
>> On 19/02/18 15:48, Jan Beulich wrote:
>>> Just like pte_{set,clear}_flags() their PMD and PUD counterparts should
>>> not do any address translation. This was outright wrong under Xen
>>> (causing a dead boot with no useful output on "suitable" systems), and
>>> produced needlessly more complicated code (even if just slightly) when
>>> paravirt was enabled.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>> Cc: stable@vger.kernel.org
>>
>> While the changes look alright I'm really curious which kind of failure
>> you are seeing, especially considering how long those functions haven't
>> been changed (since more than 6 years).
>
> It's the new use of pmd_set_flags() in 2cc42bac1c ("x86-64/Xen:
> eliminate W+X mappings"), and due to the (very odd afaic) identity
> map handling the issue is invisible on most systems/setups.
Aah, okay. This helps.
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] x86: fix {pmd,pud}_{set,clear}_flags()
@ 2018-02-19 14:48 Jan Beulich
0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-02-19 14:48 UTC (permalink / raw)
To: mingo, tglx, hpa; +Cc: Boris Ostrovsky, Juergen Gross, linux-kernel
Just like pte_{set,clear}_flags() their PMD and PUD counterparts should
not do any address translation. This was outright wrong under Xen
(causing a dead boot with no useful output on "suitable" systems), and
produced needlessly more complicated code (even if just slightly) when
paravirt was enabled.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
---
arch/x86/include/asm/pgtable.h | 8 ++++----
arch/x86/include/asm/pgtable_types.h | 10 ++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
--- 4.16-rc2/arch/x86/include/asm/pgtable.h
+++ 4.16-rc2-x86-pXd_set_flags-no-xlat/arch/x86/include/asm/pgtable.h
@@ -350,14 +350,14 @@ static inline pmd_t pmd_set_flags(pmd_t
{
pmdval_t v = native_pmd_val(pmd);
- return __pmd(v | set);
+ return native_make_pmd(v | set);
}
static inline pmd_t pmd_clear_flags(pmd_t pmd, pmdval_t clear)
{
pmdval_t v = native_pmd_val(pmd);
- return __pmd(v & ~clear);
+ return native_make_pmd(v & ~clear);
}
static inline pmd_t pmd_mkold(pmd_t pmd)
@@ -409,14 +409,14 @@ static inline pud_t pud_set_flags(pud_t
{
pudval_t v = native_pud_val(pud);
- return __pud(v | set);
+ return native_make_pud(v | set);
}
static inline pud_t pud_clear_flags(pud_t pud, pudval_t clear)
{
pudval_t v = native_pud_val(pud);
- return __pud(v & ~clear);
+ return native_make_pud(v & ~clear);
}
static inline pud_t pud_mkold(pud_t pud)
--- 4.16-rc2/arch/x86/include/asm/pgtable_types.h
+++ 4.16-rc2-x86-pXd_set_flags-no-xlat/arch/x86/include/asm/pgtable_types.h
@@ -323,6 +323,11 @@ static inline pudval_t native_pud_val(pu
#else
#include <asm-generic/pgtable-nopud.h>
+static inline pud_t native_make_pud(pudval_t val)
+{
+ return (pud_t) { .p4d.pgd = native_make_pgd(val) };
+}
+
static inline pudval_t native_pud_val(pud_t pud)
{
return native_pgd_val(pud.p4d.pgd);
@@ -344,6 +349,11 @@ static inline pmdval_t native_pmd_val(pm
#else
#include <asm-generic/pgtable-nopmd.h>
+static inline pmd_t native_make_pmd(pmdval_t val)
+{
+ return (pmd_t) { .pud.p4d.pgd = native_make_pgd(val) };
+}
+
static inline pmdval_t native_pmd_val(pmd_t pmd)
{
return native_pgd_val(pmd.pud.p4d.pgd);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-19 17:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <5A8AF1BB02000078001A91C3@suse.com>
2018-02-19 16:23 ` [PATCH] x86: fix {pmd,pud}_{set,clear}_flags() Juergen Gross
2018-02-19 17:04 ` Jan Beulich
[not found] ` <5A8B119F02000078001A9412@suse.com>
2018-02-19 17:41 ` Juergen Gross
2018-02-19 14:48 Jan Beulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®