From: "Zhang, Qiang1" <qiang1.zhang@intel.com>
To: Marco Elver <elver@google.com>
Cc: "paulmck@kernel.org" <paulmck@kernel.org>,
"ryabinin.a.a@gmail.com" <ryabinin.a.a@gmail.com>,
"urezki@gmail.com" <urezki@gmail.com>,
"Miao, Jun" <jun.miao@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] rcu: record kasan stack before enter local_irq_save()/restore() critical area
Date: Fri, 24 Dec 2021 03:22:57 +0000 [thread overview]
Message-ID: <PH0PR11MB58802F642473BA6213446AB7DA7F9@PH0PR11MB5880.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CANpmjNOmaSxqTjUd8y=A+sK0jGg6c00t8uvmOey+QrJsDamsmQ@mail.gmail.com>
On Wed, 22 Dec 2021 at 08:54, Zqiang <qiang1.zhang@intel.com> wrote:
> The kasan_record_aux_stack_noalloc() only record stack, it doesn't
> need to be called in local_irq_save()/restore() critical area, and the
> global spinlock (depot_lock) will be acquired in this function, When
> enable kasan stack, locking contention may increase the time in the critical area.
>
>I think the change itself is harmless, because
>kasan_record_aux_stack_noalloc() doesn't care if interrupts are enabled or not when called, but the justification isn't clear to me.
>
>What "locking contention" are you speaking about? You're moving a
>local_irq_save() which disables interrupts. Yes, it might be nice to reduce the time interrupts are disabled, but in this case the benefit (if any) isn't clear at all, also because this only benefits non-production KASAN kernels.
>
>Can you provide better justification? Did you encounter a specific problem, maybe together with data?
>
Thanks for reply, Yes, this only benefits non-production KASAN kernel. In KASAN kernel,
there may be a lot of call stack recorded, in addition to locking competition, the find_stack() will
also take a long time.
Thanks,
Zqiang
>Thanks,
>-- Marco
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
> kernel/rcu/tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index
> 347dae1876a6..5198e44cb124 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3030,8 +3030,8 @@ __call_rcu(struct rcu_head *head, rcu_callback_t func)
> }
> head->func = func;
> head->next = NULL;
> - local_irq_save(flags);
> kasan_record_aux_stack_noalloc(head);
> + local_irq_save(flags);
> rdp = this_cpu_ptr(&rcu_data);
>
> /* Add the callback to our list. */
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-12-24 3:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 7:54 Zqiang
2021-12-23 15:08 ` Marco Elver
2021-12-24 3:22 ` Zhang, Qiang1 [this message]
2021-12-24 11:02 ` Marco Elver
2021-12-25 8:39 ` Zhang, Qiang1
2021-12-25 9:36 ` Marco Elver
2021-12-25 10:48 ` Zhang, Qiang1
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=PH0PR11MB58802F642473BA6213446AB7DA7F9@PH0PR11MB5880.namprd11.prod.outlook.com \
--to=qiang1.zhang@intel.com \
--cc=elver@google.com \
--cc=jun.miao@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=urezki@gmail.com \
/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®