lkml.org 
[lkml]   [2012]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 7/8] x86/apic: Make cpu_mask_to_apicid() operations return error code
From
Date
On Thu, 2012-06-07 at 15:15 +0200, Alexander Gordeev wrote:
> Current cpu_mask_to_apicid() and cpu_mask_to_apicid_and()
> implementations have few shortcomings:
>
> 1. A value returned by cpu_mask_to_apicid() is written to hardware
> registers unconditionally. Should BAD_APICID get ever returned it will
> be written to a hardware too. But the value of BAD_APICID is not
> universal across all hardware in all modes and might cause unexpected
> results, i.e. interrupts might get routed to CPUs that are not
> configured to receive it.
>
> 2. Because the value of BAD_APICID is not universal it is counter-
> intuitive to return it for a hardware where it does not make sense
> (i.e. x2apic).
>
> 3. cpu_mask_to_apicid_and() operation is thought as an complement to
> cpu_mask_to_apicid() that only applies a AND mask on top of a cpumask
> being passed. Yet, as consequence of 18374d8 commit the two operations
> are inconsistent in that of:
> cpu_mask_to_apicid() should not get a offline CPU with the cpumask
> cpu_mask_to_apicid_and() should not fail and return BAD_APICID
> These limitations are impossible to realize just from looking at the
> operations prototypes.
>
> Most of these shortcomings are resolved by returning a error code
> instead of BAD_APICID. As the result, faults are reported back early
> rather than possibilities to cause a unexpected behaviour exist (in case
> of [1]).
>
> The only exception is setup_timer_IRQ0_pin() routine. Although obviously
> controversial to this fix, its existing behaviour is preserved to not
> break the fragile check_timer() and would better addressed in a separate
> fix.
>

I am ok with these changes. But even better would be to remove the
cpu_mask_to_apicid() and just use cpu_mask_to_apicid_and() instead.

Looks like there are only two places cpu_mask_to_apicid() being used
anyways. So instead of patches 7 and 8, can you remove
cpu_mask_to_apicid() in patch-7 and fixup the return value of
cpu_mask_to_apicid_and() in patch-8

thanks,
suresh



\
 
 \ /
  Last update: 2012-06-08 00:41    [W:0.265 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site