Skip to contentSkip to conversation

please revert c/s 17686

DISCUSSION Jan Beulich 3 participants 12 messages Jun 12, 2008 – Jun 13, 2008

lore
Share & tools
lore
#0 lore raw

Switching HPET into legacy mode is not acceptable, as this doesn't only cut off the PIT channel 0 interrupt, but also the RTC one. The former is acceptable as no domain will ever gain control over it, but the latter isn't as Dom0 may validly make use of it. I'm observing a failure of setting the system clock correctly due to this issue (hwclock checks whether the RTC update interrupt is occurring as expected), and I suppose other uses of /dev/rtc would also suffer.

It is my understanding that using the HPET to overcome the APIC timer stop issue is therefore impossible at present - you cannot use legacy mode, and you also cannot use the individual routing mode as whatever IRQ is chosen may turn out being in use by one or more other devices (and hence would require sharing the IRQ between Xen and one or more guests).

Thanks, Jan

#1 lore raw

Probably best to just disable hpet_broadcast_init() for now, as this could be fixed e.g., by using FSB delivery on some systems. Also the C-state support looks buggy right now because we shouldn't use C3 (or deeper) unless hpet_broadcast mechanism is available to us. Otherwise we can sleep forever.

-- Keir

Quoted 22 lines · Jan Beulich

Switching HPET into legacy mode is not acceptable, as this doesn't only cut off the PIT channel 0 interrupt, but also the RTC one. The former is acceptable as no domain will ever gain control over it, but the latter isn't as Dom0 may validly make use of it. I'm observing a failure of setting the system clock correctly due to this issue (hwclock checks whether the RTC update interrupt is occurring as expected), and I suppose other uses of /dev/rtc would also suffer.

It is my understanding that using the HPET to overcome the APIC timer stop issue is therefore impossible at present - you cannot use legacy mode, and you also cannot use the individual routing mode as whatever IRQ is chosen may turn out being in use by one or more other devices (and hence would require sharing the IRQ between Xen and one or more guests).

Thanks, Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 12.06.08 15:56 >>>

Probably best to just disable hpet_broadcast_init() for now, as this could be fixed e.g., by using FSB delivery on some systems. Also the C-state support looks buggy right now because we shouldn't use C3 (or deeper) unless hpet_broadcast mechanism is available to us. Otherwise we can sleep forever.

Yes, that is something I noticed after I sent the original mail.

Jan

#3 lore raw
In reply to Jan Beulich

I checked in c/s 17844 to address this issue. We do not call hpet_broadcast_init() and this now has the knock-on effect that we never use state C3.

-- Keir

Quoted 22 lines · Jan Beulich

Switching HPET into legacy mode is not acceptable, as this doesn't only cut off the PIT channel 0 interrupt, but also the RTC one. The former is acceptable as no domain will ever gain control over it, but the latter isn't as Dom0 may validly make use of it. I'm observing a failure of setting the system clock correctly due to this issue (hwclock checks whether the RTC update interrupt is occurring as expected), and I suppose other uses of /dev/rtc would also suffer.

It is my understanding that using the HPET to overcome the APIC timer stop issue is therefore impossible at present - you cannot use legacy mode, and you also cannot use the individual routing mode as whatever IRQ is chosen may turn out being in use by one or more other devices (and hence would require sharing the IRQ between Xen and one or more guests).

Thanks, Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

Ok. Without hpet_broadcast, C3 can't work now.

First, we need to add check for mechanism readiness before entering C3 to avoid sleeping forever as you mentioned.

Second, there are 3 options to reenable C3.
- Use pit_broadcast. Straightforward, may have some impacts on
tick-less effect.
- Emulate RTC with legacy HPET. Need back porting from latest Linux
kernel.
- Enable FSB delivery for HPET interrupt. Not all models support this
mode.

We would like to go with pit_broadcast first to ensure the C3 usability, and look at other options later.

Thank Jan for your finding on this.

Jimmy

Quoted 2 lines · Keir Fraser

I checked in c/s 17844 to address this issue. We do not call hpet_broadcast_init() and this now has the knock-on effect that we

never

Quoted 7 lines

use state C3.

-- Keir

Quoted 1 line · Jan Beulich

Switching HPET into legacy mode is not acceptable, as this doesn't

only

Quoted 1 line
Quoted 1 line

cut off the PIT channel 0 interrupt, but also the RTC one. The former

is

Quoted 1 line
Quoted 1 line

acceptable as no domain will ever gain control over it, but the

latter

Quoted 26 lines
Quoted 12 lines

isn't as Dom0 may validly make use of it. I'm observing a failure of setting the system clock correctly due to this issue (hwclock checks whether the RTC update interrupt is occurring as expected), and I suppose other uses of /dev/rtc would also suffer.

It is my understanding that using the HPET to overcome the APIC timer stop issue is therefore impossible at present - you cannot use legacy mode, and you also cannot use the individual routing mode as whatever IRQ is chosen may turn out being in use by one or more other devices (and hence would require sharing the IRQ between Xen and one or more guests).

Quoted 7 lines

Thanks, Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 13 lines · Gang

Ok. Without hpet_broadcast, C3 can't work now.

First, we need to add check for mechanism readiness before entering C3 to avoid sleeping forever as you mentioned.

Second, there are 3 options to reenable C3.
- Use pit_broadcast. Straightforward, may have some impacts on
tick-less effect.
- Emulate RTC with legacy HPET. Need back porting from latest Linux
kernel.
- Enable FSB delivery for HPET interrupt. Not all models support this
mode.

Quoted 2 lines

We would like to go with pit_broadcast first to ensure the C3 usability, and look at other options later.

Will you keep the 10ms tick in this case? If that's acceptable it should be a simple patch.

-- Keir

#6 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 13.06.08 09:31 >>>

Quoted 13 lines · Gang

Ok. Without hpet_broadcast, C3 can't work now.

First, we need to add check for mechanism readiness before entering C3 to avoid sleeping forever as you mentioned.

Second, there are 3 options to reenable C3.
- Use pit_broadcast. Straightforward, may have some impacts on
tick-less effect.
- Emulate RTC with legacy HPET. Need back porting from latest Linux
kernel.
- Enable FSB delivery for HPET interrupt. Not all models support this
mode.

Quoted 5 lines
Quoted 2 lines

We would like to go with pit_broadcast first to ensure the C3 usability, and look at other options later.

Will you keep the 10ms tick in this case? If that's acceptable it should be a simple patch.

I think it would be nice it the tick was enabled only when at least one CPU actually is about to enter or in C3. And I'm not certain whether it wouldn't be possible to use a larger value than 10ms - at least in the case where all CPUs are in C3 (but I see that this case doesn't really seem to be expected anyway, given the warning handle_hpet_broadcast() generates when the current CPU is in the channel's mask; I'm also unclear about how the warning is avoided when the CPU currently in charge of handling the timer interrupt is to enter C3 - maybe I'm overlooking a place where the affinity get changed).

Jan

#7 lore raw
Quoted 12 lines · Jan Beulich
Quoted 2 lines

Will you keep the 10ms tick in this case? If that's acceptable it should be a simple patch.

I think it would be nice it the tick was enabled only when at least one CPU actually is about to enter or in C3. And I'm not certain whether it wouldn't be possible to use a larger value than 10ms - at least in the case where all CPUs are in C3 (but I see that this case doesn't really seem to be expected anyway, given the warning handle_hpet_broadcast() generates when the current CPU is in the channel's mask; I'm also unclear about how the warning is avoided when the CPU currently in charge of handling the timer interrupt is to enter C3 - maybe I'm overlooking a place where the affinity get changed).

I missed that warning printk. It does indeed look odd.

-- Keir

#8 lore raw
Quoted 4 lines · Keir Fraser
Quoted 2 lines · Jan Beulich
Quoted 2 lines

Will you keep the 10ms tick in this case? If that's acceptable it should be a simple patch.

We have similar considerations as Jan mentioned below. We will try larger interval & dynamically enable/disable.

Quoted 2 lines
Quoted 2 lines

I think it would be nice it the tick was enabled only when at least

one

Quoted 2 lines
Quoted 2 lines

CPU actually is about to enter or in C3. And I'm not certain whether it wouldn't be possible to use a larger value than 10ms - at least in

the

Quoted 1 line
Quoted 1 line

case where all CPUs are in C3 (but I see that this case doesn't

really

Quoted 5 lines
Quoted 5 lines

seem to be expected anyway, given the warning handle_hpet_broadcast() generates when the current CPU is in the channel's mask; I'm also unclear about how the warning is avoided when the CPU currently in charge of handling the timer interrupt is to enter C3 - maybe I'm overlooking a place where the affinity get changed).

For the current implementation, the hpet_broadcast_exit() will be executed before irq enabled, so the handle_hpet_broadcast() will always get executed after the mask was cleared. We will look into whether it is better to move hpet_broadcast_exit() after local_irq_enable().

Quoted 2 lines

I missed that warning printk. It does indeed look odd.

As to this warning printk, we can simply replace it with an assert.

Jimmy

#9 lore raw
Quoted 3 lines
Quoted 1 line

I missed that warning printk. It does indeed look odd.

As to this warning printk, we can simply replace it with an assert.

That would make things worse, not better - the condition simply must be allowed (as said before, otherwise you won't be able to bring all CPUs at once into C3).

Jan

#10 lore raw
Quoted 7 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line

I missed that warning printk. It does indeed look odd.

As to this warning printk, we can simply replace it with an assert.

That would make things worse, not better - the condition simply must be allowed (as said before, otherwise you won't be able to bring all CPUs at once into C3).

I think that C2/C3 are entered with IRQs disabled, but IRQ pending will kick the CPU out of C2/C3 nonetheless. That CPU will then execute hpet_broadcast_exit() before local_irq_enable() and hence the warning printk will never actually fire. So it would be correct as a BUG_ON().

Is this correct, Wei?

-- Keir

#11 lore raw
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line

I missed that warning printk. It does indeed look odd.

As to this warning printk, we can simply replace it with an assert.

That would make things worse, not better - the condition simply must

be

Quoted 1 line
Quoted 1 line

allowed (as said before, otherwise you won't be able to bring all

CPUs

Quoted 3 lines
Quoted 1 line

at once into C3).

I think that C2/C3 are entered with IRQs disabled, but IRQ pending

will

Quoted 5 lines

kick the CPU out of C2/C3 nonetheless. That CPU will then execute hpet_broadcast_exit() before local_irq_enable() and hence the warning printk will never actually fire. So it would be correct as a BUG_ON().

Is this correct, Wei?

Absolutely right. And we will look into whether it is better to move hpet_broadcast_exit() after local_irq_enable().

Jimmy