From: Dave Hansen <dave.hansen@intel.com>
To: "Singh, Brijesh" <brijesh.singh@amd.com>,
"x86@kernel.org" <x86@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Dan Williams <dan.j.williams@intel.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Lendacky, Thomas" <Thomas.Lendacky@amd.com>
Subject: Re: [PATCH v2] x86: mm: Do not use set_{pud,pmd}_safe when splitting the large page
Date: Mon, 15 Apr 2019 08:58:52 -0700 [thread overview]
Message-ID: <1aec4241-09c0-5295-7bb7-235e9a494d2c@intel.com> (raw)
In-Reply-To: <20190415145515.13559-1-brijesh.singh@amd.com>
On 4/15/19 7:55 AM, Singh, Brijesh wrote:
> static unsigned long __meminit
> phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
> - pgprot_t prot)
> + pgprot_t prot, bool safe)
> {
> unsigned long pages = 0, paddr_next;
> unsigned long paddr_last = paddr_end;
> @@ -432,7 +463,7 @@ phys_pte_init(pte_t *pte_page, unsigned long paddr, unsigned long paddr_end,
> E820_TYPE_RAM) &&
> !e820__mapped_any(paddr & PAGE_MASK, paddr_next,
> E820_TYPE_RESERVED_KERN))
> - set_pte_safe(pte, __pte(0));
> + __set_pte(pte, __pte(0), safe);
> continue;
> }
The changelog is great, btw.
But, I'm not a big fan of propagating the 'safe' nomenclature. Could
we, at least, call it 'overwrite_safe' or something if we're going to
have a variable name? Or even, 'new_entries_only' or something that
actually conveys meaning?
Because, just reading it, I always wonder "why do we have an unsafe
variant, that's stupid" every time. :)
> +#define DEFINE_ENTRY(type1, type2, safe) \
> +static inline void __set_##type1(type1##_t *arg1, \
> + type2##_t arg2, bool safe) \
> +{ \
> + if (safe) \
> + set_##type1##_safe(arg1, arg2); \
> + else \
> + set_##type1(arg1, arg2); \
> +}
While I appreciate the brevity that these macros allow, I detest their
ability to thwart cscope and grep. I guess it's just one file, but it
does make me grumble a bit.
Also, can we do better than "__"? Aren't these specific to
initialization, and only for the kernel? Maybe we should call them
meminit_set_pte() or kern_set_pte() or something so make it totally
clear to the reader that they're new.
> - kernel_physical_mapping_init(__pa(vaddr & pmask),
> - __pa((vaddr_end & pmask) + psize),
> - split_page_size_mask);
> + kernel_physical_mapping_change(__pa(vaddr & pmask),
> + __pa((vaddr_end & pmask) + psize),
> + split_page_size_mask);
BTW, this hunk is really nice the way that the new naming makes it more
intuitive what's going on. My only nit w9uld be that we now have two
very similarly-named functions with different TLB-flushing requirements.
Could we please include a comment at this site that reminds us that we
owe a TLB flush after this?
next prev parent reply other threads:[~2019-04-15 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 14:55 Singh, Brijesh
2019-04-15 15:58 ` Dave Hansen [this message]
2019-04-15 16:14 ` Peter Zijlstra
2019-04-16 20:30 ` Singh, Brijesh
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=1aec4241-09c0-5295-7bb7-235e9a494d2c@intel.com \
--to=dave.hansen@intel.com \
--cc=Thomas.Lendacky@amd.com \
--cc=bp@alien8.de \
--cc=brijesh.singh@amd.com \
--cc=dan.j.williams@intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--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®