linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Marco Elver <elver@google.com>
To: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Cc: catalin.marinas@arm.com, will@kernel.org, glider@google.com,
	 dvyukov@google.com, akpm@linux-foundation.org,
	robin.murphy@arm.com,  mark.rutland@arm.com, jianyong.wu@arm.com,
	james.morse@arm.com,  linux-arm-kernel@lists.infradead.org,
	kasan-dev@googlegroups.com,  linux-mm@kvack.org,
	quic_pkondeti@quicinc.com, quic_guptap@quicinc.com,
	 quic_tingweiz@quicinc.com
Subject: Re: [PATCH] mm,kfence: decouple kfence from page granularity mapping judgement
Date: Thu, 9 Mar 2023 12:38:43 +0100	[thread overview]
Message-ID: <CANpmjNOT9kk00nps2vcZ8_Zuh+m1zVpReT+k28U4iD7iOC5cQw@mail.gmail.com> (raw)
In-Reply-To: <3e8606e4-0585-70fa-433d-75bf115aa191@quicinc.com>

On Thu, 9 Mar 2023 at 12:26, Zhenhua Huang <quic_zhenhuah@quicinc.com> wrote:
[...]
> > Ah right - well, you can initialize __kfence_pool however you like
> > within arm64 init code. Just teaching kfence_alloc_pool() to do
> > nothing if it's already initialized should be enough. Within
> > arch/arm64/mm/mmu.c it might be nice to factor out some bits into a
> > helper like arm64_kfence_alloc_pool(), but would just stick to
> > whatever is simplest.
>
> Many thanks Marco. Let me conclude as following:
> 1. put arm64_kfence_alloc_pool() within arch/arm64/mm/mmu.c as it's
> arch_ specific codes.
> 2. leave kfence_set_pool() to set _kfence_pool within kfence driver, as
> it may become common part.
>
> The reason we still need #2 is because _kfence_pool only can be used
> after mapping set up, it must be late than pool allocation. Do you have
> any further suggestion?

I don't mind kfence_set_pool() if it helps avoid some #ifdef CONFIG_KFENCE.

However, do note that __kfence_pool is exported from
include/linux/kfence.h. Since you guard all the new arm64 code by
#ifdef CONFIG_KFENCE, kfence_set_pool() doesn't look necessary.
However, if you do something like:

#ifdef CONFIG_KFENCE
... define arm64_kfence_alloc_pool ...
#else
... define empty arm64_kfence_alloc_pool that returns NULL ...
#endif

and make that the only #ifdef CONFIG_KFENCE in the new arm64 code,
then you need kfence_set_pool(). I think that'd be preferable, so that
most code is always compile-tested, even if the compiler ends up
optimizing it out if it's dead code if !CONFIG_KFENCE.

Thanks,
-- Marco


  reply	other threads:[~2023-03-09 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  8:05 Zhenhua Huang
2023-03-09 10:33 ` Marco Elver
2023-03-09 11:03   ` Zhenhua Huang
2023-03-09 11:09     ` Marco Elver
2023-03-09 11:26       ` Zhenhua Huang
2023-03-09 11:38         ` Marco Elver [this message]
2023-03-09 15:38           ` Zhenhua Huang

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=CANpmjNOT9kk00nps2vcZ8_Zuh+m1zVpReT+k28U4iD7iOC5cQw@mail.gmail.com \
    --to=elver@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=james.morse@arm.com \
    --cc=jianyong.wu@arm.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=quic_guptap@quicinc.com \
    --cc=quic_pkondeti@quicinc.com \
    --cc=quic_tingweiz@quicinc.com \
    --cc=quic_zhenhuah@quicinc.com \
    --cc=robin.murphy@arm.com \
    --cc=will@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