mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Nadav Amit <namit@vmware.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] smp: Allow smp_call_function_single_async() to insert locked csd
Date: Tue, 17 Dec 2019 15:48:39 -0500	[thread overview]
Message-ID: <20191217204839.GH7258@xz-x1> (raw)
In-Reply-To: <20191217202352.GH2844@hirez.programming.kicks-ass.net>

On Tue, Dec 17, 2019 at 09:23:52PM +0100, Peter Zijlstra wrote:
> > > I suspect to be nice for virt. Both CPUID and MSR accesses can trap. but
> > > now I'm confused, because it is mostly WRMSR that traps.
> > > 
> > > Anyway, see the commit here: 07cde313b2d2 ("x86/msr: Allow rdmsr_safe_on_cpu() to schedule")
> > 
> > Yes that makes sense.  Thanks for the pointer.
> > 
> > However, then my next confusion is why they can't provide a common
> > solution to the smp code again... I feel like it could be even easier
> > (please see below).  I'm not very familiar with smp code yet, but if
> > it works it should benefit all callers imho.
> 
> Ah, so going to sleep on wait_for_completion() is _much_ more expensive
> than a short spin. So it all depends on the expected behaviour of the
> IPI I suppose.
> 
> In general we expect these IPIs to be 'quick'.
> 
> Also, as is, you're allowed to use the smp_call_function*() family with
> preemption disabled, which pretty much precludes using
> wait_for_completion().

Yes you are right, thanks!

Though I feel like previous small patch could still be an small
enhancement in that it at least shortened the get_cpu() period of
smp_call_function_single() without losing anything - so that could
still give the caller a chance to be scheduled out of the spinning at
some point when the IPI conditionally takes time to finish, imho.

-- 
Peter Xu


      reply	other threads:[~2019-12-17 20:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 20:48 Peter Xu
2019-12-11 15:40 ` Peter Zijlstra
2019-12-11 16:29   ` Peter Xu
2019-12-16 20:37     ` Peter Zijlstra
2019-12-16 20:58       ` Peter Xu
2019-12-17  9:51         ` Peter Zijlstra
2019-12-17 15:31           ` Peter Xu
2019-12-17 20:23             ` Peter Zijlstra
2019-12-17 20:48               ` Peter Xu [this message]

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=20191217204839.GH7258@xz-x1 \
    --to=peterx@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=namit@vmware.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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®