When there are more FSB delivery capable HPET channels than CPU cores
(or threads), we can simply use a dedicated channel per CPU. This
avoids wasting the resources to handle the excess channels (including
the pointless triggering of the respective interrupt on each
wraparound) as well as the ping-pong of the interrupts' affinities
(when getting assigned to different CPUs).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
if ( !hpet_events )
return;
- for ( i = 0; i < num_chs; i++ )
+ for ( i = 0; i < num_chs && num_hpets_used < nr_cpu_ids; i++ )
{
struct hpet_event_channel *ch = &hpet_events[num_hpets_used];
u32 cfg = hpet_read32(HPET_Tn_CFG(i));
if ( num_hpets_used == 0 )
return hpet_events;
+ if ( num_hpets_used >= nr_cpu_ids )
+ return &hpet_events[cpu];
+
do {
next = next_channel;
if ( (i = next + 1) == num_hpets_used )