[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/smp: Support NULL IPI function pointers


  • To: Andrew Cooper <amc96@xxxxxxxx>
  • From: Luca Fancellu <luca.fancellu@xxxxxxx>
  • Date: Mon, 22 Nov 2021 09:21:07 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ypy0E2zDODZ5qMPEXKzGJccxLsfBNu+Kogv5z5YM6fc=; b=m2l5/iI4X7Wi1NR7oDz5N2u0LxWtTZrrFN9+Zw2M8bPL/xSdoxF7HenWS+y92MwDBLEELMgtHFx3R4upBiaP8QhT8YeTzIp8MhjsbXxVLbFyif6TkI0a8n19di7tjPl6gG9Sk37XRIE3FfroNjC1Jqa1m8gC2z1Q/Bqqy0x5jBx1utiiYySk+a2C0rQeV9zusUVlk7/lWWw3zA1YSQstYPjj5t0mE9BkbCPYQIm5UIcEcz/v/Gx8qZe/eokXe4g7nJ0d7Z/+JBLOKKjqBd7XfgicGUh72Aq2EBN1t2Hhc54HeMsQsl70Jx+soKx66l64uHTWK1oHvYLOKpteB1Wo4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F66oIgP0Fwe9evaDEIV7iVLWVlHXvzlpmCS3wMN4wy+wdW9sYJpd2CgZ6b7gs/YL6A/wsqVYYpUGCwDxQrfh+tRO/VVI6HKhNuvj+tS7gKx03jFilLTMVT9EzMXltYm0AfQHJtfMbhadAy3+ck/9G2a0J+IuJSjja1CWLCo2Z1Tujh/Zf0CB1OI7ZcKscGzOP/e26rNeqrZAVkSzKQjYFhCd04MTX8JJzrE0ptN9LDSk6mS6FdAaXZLLGwZLFXcvx5S1vm9qbUELEz3J4LdS2KkM5ZILhJnoGvKJh8XKw//3cdl94xMgvWMgBhcc+CWIZIyT/isPqZeb2TPer6bfPA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 22 Nov 2021 09:21:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;


> On 18 Nov 2021, at 10:35, Andrew Cooper <amc96@xxxxxxxx> wrote:
> 
> On 18/11/2021 09:58, Jan Beulich wrote:
>> On 17.11.2021 17:48, Andrew Cooper wrote:
>>> There are several cases where the act of interrupting a remote processor has
>>> the required side effect.  Explicitly allow NULL function pointers so the
>>> calling code doesn't have to provide a stub implementation.
>>> 
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>> ---
>>> CC: Jan Beulich <JBeulich@xxxxxxxx>
>>> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>>> CC: Wei Liu <wl@xxxxxxx>
>>> 
>>> The wait parameter is a little weird.  It serves double duty and will 
>>> confirm
>>> that the IPI has been taken.  All it does is let you control whether you 
>>> also
>>> wait for the handler to complete first.  As such, it is effectively useless
>>> with a stub function.
>>> 
>>> I don't particularly like folding into the .wait() path like that, but I
>>> dislike it less than an if()/else if() and adding a 3rd cpumask_clear_cpu()
>>> into the confusion which is this logic.
>> I can accept this, albeit personally I would have preferred the extra if()
>> over the goto.
> 
> Just so it's been posted.  This is what the if/else looks like:
> 
> diff --git a/xen/common/smp.c b/xen/common/smp.c
> index 79f4ebd14502..ff569bbe9d53 100644
> --- a/xen/common/smp.c
> +++ b/xen/common/smp.c
> @@ -87,7 +87,11 @@ void smp_call_function_interrupt(void)
>  
>      irq_enter();
>  
> -    if ( call_data.wait )
> +    if ( unlikely(!func) )
> +    {
> +        cpumask_clear_cpu(cpu, &call_data.selected);
> +    }
> +    else if ( call_data.wait )
>      {
>          (*func)(info);
>          smp_mb();
> 
> 
> GCC does manage to fold this into the goto version presented originally.
> 
> If everyone else thinks this version is clearer to read then I'll go
> with it.

Hi Andrew,

I would vote for the long version if it’s not a problem.

Cheers,
Luca

> 
> ~Andrew




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.