mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86/mm: fix __swp_entry_to_pte() for Xen PV guests
Date: Tue, 25 Apr 2023 10:32:41 +0200	[thread overview]
Message-ID: <b7e75a64-6de4-504e-809d-d6dce192f430@suse.com> (raw)
In-Reply-To: <20230306123259.12461-1-jgross@suse.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1568 bytes --]

Ping?

On 06.03.23 13:32, Juergen Gross wrote:
> Normally __swp_entry_to_pte() is never called with a value translating
> to a valid PTE. The only known exception is pte_swap_tests(), resulting
> in a WARN splat in Xen PV guests, as __pte_to_swp_entry() did
> translate the PFN of the valid PTE to a guest local PFN, while
> __swp_entry_to_pte() doesn't do the opposite translation.
> 
> Fix that by using __pte() in __swp_entry_to_pte() instead of open
> coding the native variant of it.
> 
> For correctness do the similar conversion for __swp_entry_to_pmd().
> 
> Fixes: 05289402d717 ("mm/debug_vm_pgtable: add tests validating arch helpers for core MM features")
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>   arch/x86/include/asm/pgtable_64.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
> index 7929327abe00..a629b1b9f65a 100644
> --- a/arch/x86/include/asm/pgtable_64.h
> +++ b/arch/x86/include/asm/pgtable_64.h
> @@ -237,8 +237,8 @@ static inline void native_pgd_clear(pgd_t *pgd)
>   
>   #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val((pte)) })
>   #define __pmd_to_swp_entry(pmd)		((swp_entry_t) { pmd_val((pmd)) })
> -#define __swp_entry_to_pte(x)		((pte_t) { .pte = (x).val })
> -#define __swp_entry_to_pmd(x)		((pmd_t) { .pmd = (x).val })
> +#define __swp_entry_to_pte(x)		(__pte((x).val))
> +#define __swp_entry_to_pmd(x)		(__pmd((x).val))
>   
>   extern void cleanup_highmap(void);
>   


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  parent reply	other threads:[~2023-04-25  8:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 12:32 Juergen Gross
2023-03-06 14:08 ` Dave Hansen
2023-03-06 14:25   ` Juergen Gross
2023-03-27 14:26 ` Juergen Gross
2023-04-25  8:32 ` Juergen Gross [this message]
2023-05-08 12:23 ` Juergen Gross
2023-05-08 13:41 ` [tip: x86/mm] x86/mm: Fix " tip-bot2 for Juergen Gross

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=b7e75a64-6de4-504e-809d-d6dce192f430@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®