x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
PATCH 1/1 x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
Otherwise the check for the SS feature in check_memory_type_self_snoop_errata() fails unconditionally, which leads to X86_FEATURE_XEN_SELFSNOOP never being set.
We could also avoid this by not doing the reset_cpuinfo() for the BSP in identify_cpu(), because SS detection uses boot_cpu_data. However that creates an imbalance on the state of the BSP versus the APs in the identify_cpu() code.
I've opted for the less controversial solution of populating FEATURESET_1d in generic_identify(), as the value is already there. The same is done for the AMD faulting probe code.
--- xen/arch/x86/cpu/common.c | 3 +++ 1 file changed, 3 insertions(+)
xen/arch/x86/cpu/common.c +3 -0
@@ -490,6 +490,9 @@ static void generic_identify(struct cpuinfo_x86 *c) c->apicid =phys_pkg_id ((ebx >>24 ) &0xFF ,0 ); c->phys_proc_id = c->apicid; +/* Early init of Self Snoop support requires 0x1.edx. */ + c->x86_capability[FEATURESET_1d] = edx; + eax =cpuid_eax (0x80000000 );if ((eax >>16 ) ==0x8000 ) c->extended_cpuid_level = eax;
Signature · 1 line
2.51.0
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.
Doesn't this, mean ...
Quoted 10 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>
... this Fixes tag is incorrect?
~Andrew
A message that is not in the archive (sent off-list or not yet received): 2d17d2d502df489f97b51e43a2d86535@DM6PR03MB5227.namprd03.prod.outlook.com
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of identify_cpu() has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passed cpuinfo_x86 struct, as for the BSP this would be already partially initialized due to what's done in early_cpu_init().
The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of cpuinfo_x86 struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated in generic_identify(), like FEATURESET_e21a, hence the proposed patch does that for FEATURESET_1d.
Quoted 4 lines
Quoted 4 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.
Quoted 8 lines
Quoted 6 lines
I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in c_early_init hooks depended on (some of) the x86_capability fields being populated, which is required after the change.
Thanks, Roger.
Jan Beulich
Reviewed-byQuoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.
I agree. Hence:
I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Jan
Quoted 42 lines · Jan Beulich
Quoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.
Quoted 6 lines
I agree. Hence:
Reviewed-by Jan Beulich <[email protected]>I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Yeah, I was about to do it, but it's not strictly needed for c_early_init, and it's done anyway just after the call to c_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:
/* * Early init of Self Snoop support requires 0x1.edx, while * there also set 0x1.ecx as the value is already in context. */ c->x86_capability[FEATURESET_1d] = edx; c->x86_capability[FEATURESET_1c] = ecx;
Thanks, Roger.
Quoted 46 lines · Roger Pau Monné
Quoted 45 lines · Jan Beulich
Quoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.I agree. Hence:
Reviewed-by Jan Beulich <[email protected]>
Quoted 8 lines
Quoted 3 lines
I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Yeah, I was about to do it, but it's not strictly needed for
c_early_init, and it's done anyway just after the call toc_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:
Sure, i.e. fine with me.
Jan
Quoted 8 lines
/* * Early init of Self Snoop support requires 0x1.edx, while * there also set 0x1.ecx as the value is already in context. */ c->x86_capability[FEATURESET_1d] = edx; c->x86_capability[FEATURESET_1c] = ecx;Thanks, Roger.
Quoted 51 lines · Jan Beulich
Quoted 50 lines · Roger Pau Monné
Quoted 48 lines · Jan Beulich
Quoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.I agree. Hence:
Reviewed-by Jan Beulich <[email protected]>I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Quoted 6 lines
Quoted 4 lines
Yeah, I was about to do it, but it's not strictly needed for
c_early_init, and it's done anyway just after the call toc_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:Sure, i.e. fine with me.
Thanks!
Oleksii, can I please get a release-ack for this to go in?
Regards, Roger.
Quoted 52 lines · Roger Pau Monné
Quoted 51 lines · Jan Beulich
Quoted 50 lines · Roger Pau Monné
Quoted 48 lines · Jan Beulich
Quoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.I agree. Hence:
Reviewed-by Jan Beulich <[email protected]>I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Yeah, I was about to do it, but it's not strictly needed for
c_early_init, and it's done anyway just after the call toc_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:Sure, i.e. fine with me.
Oleksii, can I please get a release-ack for this to go in?
Do bug fixes actually need release-acks just yet?
Jan
Quoted 58 lines · Jan Beulich
Quoted 57 lines · Roger Pau Monné
Quoted 56 lines · Jan Beulich
Quoted 54 lines · Roger Pau Monné
Quoted 42 lines · Jan Beulich
Quoted 32 lines · Roger Pau Monné
Quoted 9 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné <[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.Quoted 6 lines
I agree. Hence:
Reviewed-by Jan Beulich <[email protected]>I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Yeah, I was about to do it, but it's not strictly needed for
c_early_init, and it's done anyway just after the call toc_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Sure, i.e. fine with me.
Oleksii, can I please get a release-ack for this to go in?
Do bug fixes actually need release-acks just yet?
I always err on the side of caution and ask for them. Maybe Oleksii can state if/when he formally wants release-acks for bugfixes.
Regards, Roger.
Quoted 52 lines · Roger Pau Monné
Quoted 51 lines · Jan Beulich
Quoted 50 lines · Roger Pau Monné
Quoted 49 lines · Jan Beulich
Quoted 48 lines · Roger Pau Monné
Quoted 37 lines · Jan Beulich
Quoted 30 lines · Roger Pau Monné
Quoted 8 lines · Andrew Cooper
Quoted 6 lines · Roger Pau Monne
Otherwise the check for the SS feature in
check_memory_type_self_snoop_errata()fails unconditionally, which leads toX86_FEATURE_XEN_SELFSNOOPnever being set.We could also avoid this by not doing the
reset_cpuinfo()for the BSP inidentify_cpu(), because SS detection usesboot_cpu_data.Doesn't this, mean ...
Well, that's the reason for the rant here. The reset at the top of
identify_cpu()has been there since 2005. It's arguably to make sure the BSP and the APs have the same empty state in the passedcpuinfo_x86struct, as for the BSP this would be already partially initialized due to what's done inearly_cpu_init().The underlying question is whether we would rather prefer to not do the reset for the BSP, but that would lead to differences in the contents of
cpuinfo_x86struct between the BSP and the APs. In the past we have arranged for leaves needed early to be populated ingeneric_identify(), likeFEATURESET_e21a, hence the proposed patch does that forFEATURESET_1d.Quoted 8 lines
Quoted 8 lines
However that
creates an imbalance on the state of the BSP versus the APs in theidentify_cpu()code.I've opted for the less controversial solution of populating
FEATURESET_1dingeneric_identify(), as the value is already there. The same is done for the AMD faulting probe code.Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Fixes f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in CPUs with known errata")Signed-off-by Roger Pau Monné<[email protected]>... this Fixes tag is incorrect?
I think the Fixes tag is accurate; the code was OK before that change. Nothing in
c_early_inithooks depended on (some of) thex86_capabilityfields being populated, which is required after the change.Quoted 6 lines
I agree. Hence:
Reviewed-by Jan Beulich<[email protected]>I wonder though whether while there we wouldn't want to also store ecx if we already have it. (Really there is the question of whether we haven't other cpu_has_* uses which similarly come "too early".)
Yeah, I was about to do it, but it's not strictly needed for
c_early_init, and it's done anyway just after the call toc_early_init. I can set that field also, but then I would need to tweak the comment ahead, something like:
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Sure, i.e. fine with me.
Oleksii, can I please get a release-ack for this to go in?
Do bug fixes actually need release-acks just yet?
I always err on the side of caution and ask for them. Maybe Oleksii can state if/when he formally wants release-acks for bugfixes.
I am okay not to have release-acks for bugfixes until the end of code freeze.
When I will announce a next stages of release process, I would put such the information explicitly.
Thanks.
~ Oleksii
Quoted 1 line
Regards, Roger.