linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Em Sharnoff <sharnoff@neon.tech>,
	linux-kernel@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org
Cc: Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	Oleg Vasilev <oleg@neon.tech>,
	Arthur Petukhovsky <arthur@neon.tech>,
	Stefan Radig <stefan@neon.tech>, Misha Sakhnov <misha@neon.tech>
Subject: Re: [PATCH v3 1/2] x86/mm: Handle alloc failure in phys_*_init()
Date: Tue, 10 Jun 2025 07:55:36 -0700	[thread overview]
Message-ID: <22cd0fa8-d14d-4d37-a6a1-5e6827d6182b@intel.com> (raw)
In-Reply-To: <a404d023-e0bb-4dc8-8952-accba299ab50@neon.tech>

On 6/10/25 03:16, Em Sharnoff wrote:
> +		if (!pmd)
> +			return (unsigned long)ERR_PTR(-ENOMEM);

All of this casting isn't great to look at. Just about every line of
code that this patch touches also introduces has a cast.

Could you please find a way to reduce the number of casts?

> +		/*
> +		 * We might have IS_ERR(paddr_last) if allocation failed, but we should
> +		 * still update pud before bailing, so that subsequent retries can pick
> +		 * up on progress (here and in phys_pmd_init) without leaking pmd.
> +		 */

Please write everything in imperative voice. No "we's", please.

> -	for (i = 0; i < nr_range; i++)
> +	for (i = 0; i < nr_range; i++) {
>  		ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
>  						   mr[i].page_size_mask,
>  						   prot);
> +		if (IS_ERR((void *)ret))
> +			return ret;
> +	}

Are there any _actual_ users of 'paddr_last'? I see a lot of setting it
and passing it around, but I _think_ this is the only place it actually
gets used. Here, the fact that it's an address doesn't even matter.




  reply	other threads:[~2025-06-10 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 10:15 [PATCH v3 0/2] x86/mm: Improve alloc handling of phys_*_init() Em Sharnoff
2025-06-10 10:16 ` [PATCH v3 1/2] x86/mm: Handle alloc failure in phys_*_init() Em Sharnoff
2025-06-10 14:55   ` Dave Hansen [this message]
2025-06-11  8:38     ` Em Sharnoff
2025-06-11 14:16       ` Dave Hansen
2025-06-11 19:26         ` Em Sharnoff
2025-06-11 19:36           ` Dave Hansen
2025-06-13 20:17             ` Em Sharnoff
2025-06-11 22:56     ` H. Peter Anvin
2025-06-10 15:07   ` Dave Hansen
2025-06-11  8:39     ` Em Sharnoff
2025-06-10 10:17 ` [PATCH v3 2/2] x86/mm: Use GFP_KERNEL for alloc_low_pages() after boot Em Sharnoff

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=22cd0fa8-d14d-4d37-a6a1-5e6827d6182b@intel.com \
    --to=dave.hansen@intel.com \
    --cc=arthur@neon.tech \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=misha@neon.tech \
    --cc=oleg@neon.tech \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=sharnoff@neon.tech \
    --cc=stefan@neon.tech \
    --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