linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Michael Kelley <mikelley@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>,
	Linux on Hyper-V List <linux-hyperv@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" 
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself
Date: Sat, 11 Sep 2021 15:24:26 +0000	[thread overview]
Message-ID: <20210911152426.gq34cigqteqvzms2@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <MWHPR21MB1593DE9DE0A474E2539FFD1BD7D79@MWHPR21MB1593.namprd21.prod.outlook.com>

On Sat, Sep 11, 2021 at 03:09:50PM +0000, Michael Kelley wrote:
> From: Wei Liu <wei.liu@kernel.org> Sent: Friday, September 10, 2021 11:57 AM
[...]
> > -static bool __send_ipi_mask(const struct cpumask *mask, int vector)
> > +static bool __send_ipi_mask(const struct cpumask *mask, int vector,
> > +		bool exclude_self)
> >  {
> > -	int cur_cpu, vcpu;
> > +	int cur_cpu, vcpu, this_cpu = smp_processor_id();
> >  	struct hv_send_ipi ipi_arg;
> >  	u64 status;
> > +	unsigned int weight;
> > 
> >  	trace_hyperv_send_ipi_mask(mask, vector);
> > 
> > -	if (cpumask_empty(mask))
> > +	weight = cpumask_weight(mask);
> > +
> > +	/*
> > +	 * Do nothing if
> > +	 *   1. the mask is empty
> > +	 *   2. the mask only contains self when exclude_self is true
> > +	 */
> > +	if (weight == 0 ||
> > +	    (exclude_self && weight == 1 && cpumask_first(mask) == this_cpu))
> 
> Nit:  cpumask_test_cpu(this_cpu, mask) would seem to be a better fit for this
> use case than cpumask_first().  But either works.

I will adjust the code when I commit this patch.

Wei.

  reply	other threads:[~2021-09-11 15:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 18:57 [PATCH v2 0/2] Remove on-stack cpumask in hv_apic.c Wei Liu
2021-09-10 18:57 ` [PATCH v2 1/2] asm-generic/hyperv: provide cpumask_to_vpset_noself Wei Liu
2021-09-11 15:06   ` Michael Kelley
2021-09-10 18:57 ` [PATCH v2 2/2] x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself Wei Liu
2021-09-11 15:09   ` Michael Kelley
2021-09-11 15:24     ` Wei Liu [this message]
2021-09-26 22:03   ` Thomas Gleixner
2021-10-05 12:53     ` Vitaly Kuznetsov
2021-10-06 11:39       ` Wei Liu
2021-09-13 10:19 ` [PATCH v2 0/2] Remove on-stack cpumask in hv_apic.c Wei Liu

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=20210911152426.gq34cigqteqvzms2@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=bp@alien8.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).