Skip to contentSkip to conversation

iommu=0 leading to panic when system defaults to using x2apic

DISCUSSION Jan Beulich 6 participants 25 messages Dec 10, 2010 – Dec 15, 2010

lore
Share & tools
lore
#0 lore raw

Why wouldn't iommu=0 imply not using the x2apic, if use of the iommu indeed is a prerequisite (which by itself seems questionable as long as APIC IDs aren't wider than 8 bits)?

Looking further at enable_bsp_x2apic(), I also wonder whether the pre-enabled case, when specifying iommu=0 and x2apic=0, can actually work if iommu=0 is a prerequisite (intremap_enabled() would return 1 in that case afaics, so the early check doesn't help).

Thanks, Jan

#1 lore raw

Are you looking at xen-4.0? I think you should look at latest xen-unstable and we can backpoprt patches if that is more satisfactory. I did a big cleanup patch yesterday which makes the code smaller and clearer than it was, yet I don't understand the dependencies between x2apic-enabled-by-bios and the need for interrupt remapping, and all that stuff.

-- Keir

Quoted 16 lines · Jan Beulich

Why wouldn't iommu=0 imply not using the x2apic, if use of the iommu indeed is a prerequisite (which by itself seems questionable as long as APIC IDs aren't wider than 8 bits)?

Looking further at enable_bsp_x2apic(), I also wonder whether the pre-enabled case, when specifying iommu=0 and x2apic=0, can actually work if iommu=0 is a prerequisite (intremap_enabled() would return 1 in that case afaics, so the early check doesn't help).

Thanks, Jan

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

#2 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

Are you looking at xen-4.0? I think you should look at latest xen-unstable

I looked at 4.0 in parallel with -unstable (non-staging) as of yesterday.

Quoted 2 lines

and we can backpoprt patches if that is more satisfactory. I did a big cleanup patch yesterday which makes the code smaller and clearer than it

I'll have a look at what you did...

Quoted 2 lines

was, yet I don't understand the dependencies between x2apic-enabled-by-bios and the need for interrupt remapping, and all that stuff.

... after hopefully those dependencies got clarified by one of the original authors.

Jan

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

Are you looking at xen-4.0? I think you should look at latest xen-unstable

I looked at 4.0 in parallel with -unstable (non-staging) as of yesterday.

Even before yesterday, xen-unstable benefits from c/s 22388, which is intended to work around the iommu=0/x2apic=0 dependency a bit. Not sure if it is fully satisfactory. And it is not backported to 4.0 as yet because, well, I don't understand this crap enough, basically.

Quoted 4 lines
Quoted 2 lines

and we can backpoprt patches if that is more satisfactory. I did a big cleanup patch yesterday which makes the code smaller and clearer than it

I'll have a look at what you did...

My change (c/s 22475) is larger, but should have no semantic change. It just tries to make things smaller and cleaner. For that alone maybe we will backport it to 4.0 too.

Quoted 5 lines
Quoted 2 lines

was, yet I don't understand the dependencies between x2apic-enabled-by-bios and the need for interrupt remapping, and all that stuff.

... after hopefully those dependencies got clarified by one of the original authors.

That would be nice. It feels like if BIOS has enabled x2apic we ought to be able to soldier on with it and not need to panic. Couldn't we ignore the x2apic-ness? Or turn it off? What about AMD boxes that support x2apic on the CPUs yet of course do not have VT-d irq remapping? Lots of questions, few answers. :-)

-- Keir

Quoted 2 lines

Jan

#4 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 3 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

Are you looking at xen-4.0? I think you should look at latest xen-unstable

Quoted 7 lines
Quoted 2 lines

I looked at 4.0 in parallel with -unstable (non-staging) as of yesterday.

Even before yesterday, xen-unstable benefits from c/s 22388, which is intended to work around the iommu=0/x2apic=0 dependency a bit. Not sure if it is fully satisfactory. And it is not backported to 4.0 as yet because, well, I don't understand this crap enough, basically.

Ah, yes, that makes it better (and I must then have looked at an older snapshot of -unstable instead).

Still, as you say, a lot of questions remain. On top of what you and I raised already, I wonder whether the APIC-ID-exceeding-8-bits case is really being handled correctly now when iommu=0.

Jan

#5 lore raw

Yes, X2apic is depend on iommu. If disable iommu when using x2apic, it will trigger the panic.

best regards
yang

Quoted 37 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: Friday, December 10, 2010 8:03 PM
To: Keir Fraser
Cc: [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 6 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 3 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · Keir Fraser

Are you looking at xen-4.0? I think you should look at latest xen-unstable

Quoted 7 lines
Quoted 2 lines

I looked at 4.0 in parallel with -unstable (non-staging) as of yesterday.

Even before yesterday, xen-unstable benefits from c/s 22388, which is intended to work around the iommu=0/x2apic=0 dependency a bit. Not sure if it is fully satisfactory. And it is not backported to 4.0 as yet because, well, I don't understand this crap enough, basically.

Ah, yes, that makes it better (and I must then have looked at an older snapshot of -unstable instead).

Still, as you say, a lot of questions remain. On top of what you and I raised already, I wonder whether the APIC-ID-exceeding-8-bits case is really being handled correctly now when iommu=0.

Jan

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

#6 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Yang Z

Yes, X2apic is depend on iommu. If disable iommu when using x2apic, it will trigger the panic.

Would mind clarifying where this dependency actually is?

Thanks, Jan

#7 lore raw

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: Friday, December 10, 2010 7:40 AM
To: Zhang, Yang Z
Cc: Keir Fraser; [email protected]; Han, Weidong
Subject: RE: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 3 lines
Quoted 1 line
Quoted 1 line · Yang Z

Yes, X2apic is depend on iommu. If disable iommu when using x2apic, it will trigger the panic.

Would mind clarifying where this dependency actually is?

Thanks, Jan

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

#8 lore raw

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 39 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: Friday, December 10, 2010 7:40 AM
To: Zhang, Yang Z
Cc: Keir Fraser; [email protected]; Han, Weidong
Subject: RE: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 3 lines
Quoted 1 line
Quoted 1 line · Yang Z

Yes, X2apic is depend on iommu. If disable iommu when using x2apic, it will trigger the panic.

Would mind clarifying where this dependency actually is?

Thanks, Jan

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

#9 lore raw

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 39 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jan Beulich
Sent: Friday, December 10, 2010 7:40 AM
To: Zhang, Yang Z
Cc: Keir Fraser; [email protected]; Han, Weidong
Subject: RE: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 3 lines
Quoted 1 line
Quoted 1 line · Yang Z

Yes, X2apic is depend on iommu. If disable iommu when using x2apic, it will trigger the panic.

Would mind clarifying where this dependency actually is?

Thanks, Jan

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

#10 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Jan

Quoted 32 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 13 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

#11 lore raw
Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Apparently not, since even Linux requires irq remapping even when none of the APIC IDs are greater than 255. Unless running on kvm or xen. I don't fully understand this particular restriction, mind you.

Actually, my guess is that x2apic mode requires a different format of APIC message with a 32-bit APICID field, legacy IOxAPIC and MSI devices do not support the new message format, and so irq remapping hardware is required to bridge the two formats, even if no actual irq remapping is occurring.

Is that a canny guess, Allen?

-- Keir

Quoted 37 lines

Jan

Quoted 33 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 14 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old
ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

#12 lore raw

Keir/Jan,

My understanding is that cluster mode requires it. I will get back to you guys after I dig out the details on this - did not get a chance to do this today.

Allen

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, December 13, 2010 1:03 AM
To: Jan Beulich; Kay, Allen M; Zhang, Yang Z
Cc: Han, Weidong; [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Apparently not, since even Linux requires irq remapping even when none of the APIC IDs are greater than 255. Unless running on kvm or xen. I don't fully understand this particular restriction, mind you.

Actually, my guess is that x2apic mode requires a different format of APIC message with a 32-bit APICID field, legacy IOxAPIC and MSI devices do not support the new message format, and so irq remapping hardware is required to bridge the two formats, even if no actual irq remapping is occurring.

Is that a canny guess, Allen?

-- Keir

Quoted 37 lines

Jan

Quoted 33 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 14 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old
ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

#13 lore raw

Well, if it is a restriction imposed by cluster mode, you know the next question is obvious: Why do we bother with cluster mode at all? I don't see that it yields us any advantage over physical mode, and we could use physical mode without interrupt remapping, that would seem to be a big bonus and simplification? Could we just kill our x2apic cluster mode logic?

-- Keir

Quoted 78 lines · Allen M

Keir/Jan,

My understanding is that cluster mode requires it. I will get back to you guys after I dig out the details on this - did not get a chance to do this today.

Allen

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, December 13, 2010 1:03 AM
To: Jan Beulich; Kay, Allen M; Zhang, Yang Z
Cc: Han, Weidong; [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Apparently not, since even Linux requires irq remapping even when none of the APIC IDs are greater than 255. Unless running on kvm or xen. I don't fully understand this particular restriction, mind you.

Actually, my guess is that x2apic mode requires a different format of APIC message with a 32-bit APICID field, legacy IOxAPIC and MSI devices do not support the new message format, and so irq remapping hardware is required to bridge the two formats, even if no actual irq remapping is occurring.

Is that a canny guess, Allen?

-- Keir

Quoted 39 lines

Jan

Quoted 35 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 16 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued
invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old
ones as they become available. Is there a requirement to separate this out?
If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

#14 lore raw

Also, even if we continued to use cluster mode for IPIs (in the hope of devising a more efficient group IPI algorithm in future) that doesn't stop us from always exposing physical mode to IOAPICs and MSI devices.

-- Keir

Quoted 91 lines · Keir Fraser

Well, if it is a restriction imposed by cluster mode, you know the next question is obvious: Why do we bother with cluster mode at all? I don't see that it yields us any advantage over physical mode, and we could use physical mode without interrupt remapping, that would seem to be a big bonus and simplification? Could we just kill our x2apic cluster mode logic?

-- Keir

Quoted 79 lines · Allen M

Keir/Jan,

My understanding is that cluster mode requires it. I will get back to you guys after I dig out the details on this - did not get a chance to do this today.

Allen

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, December 13, 2010 1:03 AM
To: Jan Beulich; Kay, Allen M; Zhang, Yang Z
Cc: Han, Weidong; [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Apparently not, since even Linux requires irq remapping even when none of the APIC IDs are greater than 255. Unless running on kvm or xen. I don't fully understand this particular restriction, mind you.

Actually, my guess is that x2apic mode requires a different format of APIC message with a 32-bit APICID field, legacy IOxAPIC and MSI devices do not support the new message format, and so irq remapping hardware is required to bridge the two formats, even if no actual irq remapping is occurring.

Is that a canny guess, Allen?

-- Keir

Quoted 40 lines

Jan

Quoted 36 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 17 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued
invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old
ones as they become available. Is there a requirement to separate this out?
If so, we will need to re-design iommu boot parameter which took a while to
get it right so most systems can now boot successfully.

Allen

#15 lore raw
In reply to Keir Fraser

OK, forget what I said about cluster mode in previous message. I investigated into this in more detail today and here is what I found:

Keir's interpretation in previous message is basically correct. Currently, both MSI and IOAPIC address register consists of 32 bits. Bits 31:20 are occupied by 0xFEE so there aren't enough bits to accommodate full 32-bit APIC ID's. As a result new format is define for x2apic to accommodate full 32-bit APIC ID's.

The problem is legacy MSI and IOAPIC devices still have 8-bit APIC ID's so interrupt remapping is used to be the intermediary between the legacy MSI devices and ioapics and CPUs in x2APIC mode.

Although it is possible to do turn on x2APIC on systems with less than 256 CPU's without using interrupt remapping, this configuration is not supported by the architecture in order to simplify HW validation.

Instead, BIOS is required to start the system in xAPIC mode for systems with less than 256 CPUs. It will turn on x2APIC mode for systems with more than 256 CPU's. On these systems, Xen will need to enable VT-d/interrupt remapping for x2APIC to work properly.

Allen

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, December 13, 2010 11:45 PM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: Han, Weidong; [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Well, if it is a restriction imposed by cluster mode, you know the next question is obvious: Why do we bother with cluster mode at all? I don't see that it yields us any advantage over physical mode, and we could use physical mode without interrupt remapping, that would seem to be a big bonus and simplification? Could we just kill our x2apic cluster mode logic?

-- Keir

Quoted 78 lines · Allen M

Keir/Jan,

My understanding is that cluster mode requires it. I will get back to you guys after I dig out the details on this - did not get a chance to do this today.

Allen

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Monday, December 13, 2010 1:03 AM
To: Jan Beulich; Kay, Allen M; Zhang, Yang Z
Cc: Han, Weidong; [email protected]
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 5 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Allen M

Yes, interrupt remapping is needed to be the intermediary between legacy IOxAPIC and MSI devices and the new x2APIC in the CPU.

But isn't this only when there are APIC IDs beyond 255?

Apparently not, since even Linux requires irq remapping even when none of the APIC IDs are greater than 255. Unless running on kvm or xen. I don't fully understand this particular restriction, mind you.

Actually, my guess is that x2apic mode requires a different format of APIC message with a 32-bit APICID field, legacy IOxAPIC and MSI devices do not support the new message format, and so irq remapping hardware is required to bridge the two formats, even if no actual irq remapping is occurring.

Is that a canny guess, Allen?

-- Keir

Quoted 39 lines

Jan

Quoted 35 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Friday, December 10, 2010 10:50 AM
To: Kay, Allen M; Jan Beulich; Zhang, Yang Z
Cc: [email protected]; Han, Weidong
Subject: Re: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Ah, and the interrupt remapping dependency is because PCI(e) devices cannot address 32-bit APIC IDs?

-- Keir

Quoted 3 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be

enabled.

Quoted 16 lines

Strictly speaking DMA remapping is not required for x2apic. However, queued
invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old
ones as they become available. Is there a requirement to separate this out?
If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Allen

#16 lore raw
In reply to Kay, Allen M
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

Quoted 6 lines
    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

And why is it that Xen panics when the BIOS pre-enabled x2apic mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Thanks, Jan

#17 lore raw
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

Quoted 8 lines

And why is it that Xen panics when the BIOS pre-enabled x2apic mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Thanks, Jan

x2apic spec 2.9 section states: The default will be for the BIOS to pass the control to the OS with the local x2APICs in xAPIC mode if all x2APIC IDs reported by CPUID.0BH:EDX are less than 255, and in x2APIC mode if there are any logical processor reporting its x2APIC ID at 255 or greater.

If BIOS transitions to Xen with x2APIC enabled, there must be APIC ID > 255, which requires interrupt remapping. So we added code to check such BIOS issue.

Regards,
Weidong

#18 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · Weidong Han
Quoted 8 lines · Jan Beulich

And why is it that Xen panics when the BIOS pre-enabled x2apic mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Thanks, Jan

Quoted 8 lines

x2apic spec 2.9 section states: The default will be for the BIOS to pass the control to the OS with the local x2APICs in xAPIC mode if all x2APIC IDs reported by CPUID.0BH:EDX are less than 255, and in x2APIC mode if there are any logical processor reporting its x2APIC ID at 255 or greater.

If BIOS transitions to Xen with x2APIC enabled, there must be APIC ID > 255, which requires interrupt remapping. So we added code to check such BIOS issue.

So what would you tell a customer of yours reporting native Linux to boot fine on a certain system, but Xen dying early?

Also, from a purely technical perspective, it doesn't seem like interrupt re-mapping is a requirement for the BIOS: With native Linux booting fine, there obviously is no issue. And clearly, as long as the boot CPU has an APIC id fitting into 8 bits, interrupts ought to work fine without re-mapping.

When the boot CPU has a wider APIC ID, obviously the BIOS won't be able to bring up the system (and hence the question of booting whatever OS on top of it would be mute anyway).

Jan

#19 lore raw
In reply to Jan Beulich
Quoted 4 lines

And why is it that Xen panics when the BIOS pre-enabled x2apic mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

AFAIK, Linux also requires interrupt remapping for x2apic. I believe Weidong has fixed the panic issue in Xen when x2apic is enabled without enabling interrupt remapping. It should now behave the same way as Linux.

Allen

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, December 14, 2010 12:22 AM
To: Kay, Allen M; Zhang, Yang Z
Cc: Han, Weidong; [email protected]; Keir Fraser
Subject: RE: [Xen-devel] iommu=0 leading to panic when system defaults to using x2apic

Quoted 9 lines
Quoted 1 line
Quoted 1 line · Allen M

The architectural requirement is actually between interrupt remapping and x2apic. Since interrupt remapping is part of the VT-d feature so current software requires all VT-d features enabled in order for x2apic to be enabled.

Strictly speaking DMA remapping is not required for x2apic. However, queued invalidation is required since interrupt remapping requires queued invalidation. So x2apic dependency is as follows:

Quoted 6 lines
    x2apic->interrupt remapping->queued invalidation

Due to historical reasons, the new VT-d features were built on top of the old ones as they become available. Is there a requirement to separate this out? If so, we will need to re-design iommu boot parameter which took a while to get it right so most systems can now boot successfully.

And why is it that Xen panics when the BIOS pre-enabled x2apic mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Thanks, Jan

#20 lore raw
Quoted 9 lines
Quoted 5 lines
Quoted 1 line · Allen M

And why is it that Xen panics when the BIOS pre-enabled x2apic
mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

AFAIK, Linux also requires interrupt remapping for x2apic. I believe Weidong has fixed the panic issue in Xen when x2apic is enabled without enabling interrupt remapping. It should now behave the same way as Linux.

No - just look at the very first if() in enable_bsp_x2apic().

Jan

#21 lore raw
In reply to Kay, Allen M
Quoted 9 lines
Quoted 5 lines
Quoted 1 line · Allen M

And why is it that Xen panics when the BIOS pre-enabled x2apic
mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

AFAIK, Linux also requires interrupt remapping for x2apic. I believe Weidong has fixed the panic issue in Xen when x2apic is enabled without enabling interrupt remapping. It should now behave the same way as Linux.

Oh, and I should have added that I'm currently polishing up patches from Yinghai Lu to address this as well as other problems preventing (certain?) large boxes from booting or functioning correctly.

Jan

#22 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 5 lines
Quoted 1 line · Allen M

And why is it that Xen panics when the BIOS pre-enabled x2apic
mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Quoted 8 lines
Quoted 3 lines

AFAIK, Linux also requires interrupt remapping for x2apic. I believe Weidong has fixed the panic issue in Xen when x2apic is enabled without enabling interrupt remapping. It should now behave the same way as Linux.

Oh, and I should have added that I'm currently polishing up patches from Yinghai Lu to address this as well as other problems preventing (certain?) large boxes from booting or functioning correctly.

Yes, just want to make xen aligned to current Linux kernel behavior. BIOS guys said why Linux non-xen kernel is happy but xen kernel is not.

please check attached patches. Our big box with x2apic-preenabled, AND half cpus' apic id are above 255.

They are on top of xen-4.0.1. and first one is from Weidong in unstable.

Thanks

Yinghai Lu

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

#23 lore raw
Quoted 16 lines · Yinghai Lu
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 5 lines
Quoted 1 line · Allen M

And why is it that Xen panics when the BIOS pre-enabled x2apic
mode without also enabling interrupt re-mapping, while Linux (afaict from looking at 2.6.32 code and output from an affected machine) simply enables interrupt re-mapping in this case?

Quoted 8 lines
Quoted 3 lines

AFAIK, Linux also requires interrupt remapping for x2apic. I believe Weidong has fixed the panic issue in Xen when x2apic is enabled without enabling interrupt remapping. It should now behave the same way as Linux.

Oh, and I should have added that I'm currently polishing up patches from Yinghai Lu to address this as well as other problems preventing (certain?) large boxes from booting or functioning correctly.

Quoted 7 lines

Yes, just want to make xen aligned to current Linux kernel behavior. BIOS guys said why Linux non-xen kernel is happy but xen kernel is not.

please check attached patches. Our big box with x2apic-preenabled, AND half cpus' apic id are above 255.

They are on top of xen-4.0.1. and first one is from Weidong in unstable.

I assume Jan is going to help with posting these as a regular patch series for inclusion, with separate patches for 4.0 and 4.1 as appropriate.

-- Keir

Quoted 4 lines

Thanks

Yinghai Lu

#24 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Quoted 4 lines · Yinghai Lu

please check attached patches. Our big box with x2apic-preenabled, AND half cpus' apic id are above 255.

They are on top of xen-4.0.1. and first one is from Weidong in unstable.

I assume Jan is going to help with posting these as a regular patch series for inclusion, with separate patches for 4.0 and 4.1 as appropriate.

Yes indeed.

Jan