From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH] xen/arm: minor improvement in smp_send_call_function_mask() Date: Wed, 20 Aug 2014 10:07:32 -0500 Message-ID: <53F4B9B4.5090303@linaro.org> References: <1408423704-15059-1-git-send-email-anup.patel@linaro.org> <53F3BC41.5040409@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anup Patel Cc: Ian Campbell , Stefano Stabellini , patches , xen-devel , "stefano.stabellini" , Pranavkumar Sawargaonkar List-Id: xen-devel@lists.xenproject.org On 20/08/14 01:14, Anup Patel wrote: >> Is it necessary? What happen if Xen tries to send an SGI with an empty mask? > > If Xen tries to send SGI with empty mask then target_mask will be empty > hence cpumask_weight(&target_mask) will return 0 The GIC documentation says: "If this field is 0x00 when TargetListFilter is 0b00 , the Distributor does not forward the interrupt to any CPU interface." TargetListFilter == 0b00 => Forward interrupt to a specific list of CPUs. >> >> AFAIU, the function cpumask_weight is complex so if we can avoid it, it >> would be better. > > Can you explain more about how cpumask_weight is complex ?? cpumask_weight contains a loop and multiple addition. I doubt the case where the mask only contains the current cpu happens often. As the GIC won't forward the interrupt if the list of CPUs is empty, I don't think it's worth to add this check. > Other alternative is to use "cpumask_first(&target_mask) != NR_CPUS". The best alternative would be cpumask_empty. Regards, -- Julien Grall