All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled
@ 2023-05-31 12:00 Yanan Wang via
  2023-06-02  6:52 ` Xiaoyao Li
  0 siblings, 1 reply; 3+ messages in thread
From: Yanan Wang via @ 2023-05-31 12:00 UTC (permalink / raw)
  To: Paolo Bonzini, Babu Moger, Michael Roth, Xiaoyao Li, qemu-devel
  Cc: yuzenghui, zhangjianguo18, wanghaibin.wang, Yanan Wang

Currently, we only avoid emulating L3 cache properties for AMD CPU
when l3-cache is off, but failed to consider this case on CPUID 8000_001D.
This result in a fact that we will still have L3 caches in the VM
although we pass "host-cache-info=off,l3-cache=off" CLI to qemu.

Fixes: 8f4202fb108 ("i386: Populate AMD Processor Cache Information for cpuid 0x8000001D")
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
---
 target/i386/cpu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1242bd541a..17c367c5ba 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6337,8 +6337,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                                        &topo_info, eax, ebx, ecx, edx);
             break;
         case 3: /* L3 cache info */
-            encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
-                                       &topo_info, eax, ebx, ecx, edx);
+            if (cpu->enable_l3_cache) {
+                encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
+                                           &topo_info, eax, ebx, ecx, edx);
+            }
             break;
         default: /* end of info */
             *eax = *ebx = *ecx = *edx = 0;
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled
  2023-05-31 12:00 [PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled Yanan Wang via
@ 2023-06-02  6:52 ` Xiaoyao Li
  2023-06-09  8:14   ` wangyanan (Y) via
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaoyao Li @ 2023-06-02  6:52 UTC (permalink / raw)
  To: Yanan Wang, Paolo Bonzini, Babu Moger, Michael Roth, qemu-devel
  Cc: yuzenghui, zhangjianguo18, wanghaibin.wang

On 5/31/2023 8:00 PM, Yanan Wang wrote:
> Currently, we only avoid emulating L3 cache properties for AMD CPU
> when l3-cache is off, but failed to consider this case on CPUID 8000_001D.
> This result in a fact that we will still have L3 caches in the VM
> although we pass "host-cache-info=off,l3-cache=off" CLI to qemu.

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

Out of curiosity, do you have a valid real use case to run VM with 
"l3-cache = off"?

> Fixes: 8f4202fb108 ("i386: Populate AMD Processor Cache Information for cpuid 0x8000001D")
> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
> ---
>   target/i386/cpu.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1242bd541a..17c367c5ba 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6337,8 +6337,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
>                                          &topo_info, eax, ebx, ecx, edx);
>               break;
>           case 3: /* L3 cache info */
> -            encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
> -                                       &topo_info, eax, ebx, ecx, edx);
> +            if (cpu->enable_l3_cache) {
> +                encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
> +                                           &topo_info, eax, ebx, ecx, edx);
> +            }
>               break;
>           default: /* end of info */
>               *eax = *ebx = *ecx = *edx = 0;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled
  2023-06-02  6:52 ` Xiaoyao Li
@ 2023-06-09  8:14   ` wangyanan (Y) via
  0 siblings, 0 replies; 3+ messages in thread
From: wangyanan (Y) via @ 2023-06-09  8:14 UTC (permalink / raw)
  To: Xiaoyao Li, Paolo Bonzini, Babu Moger, Michael Roth, qemu-devel
  Cc: yuzenghui, zhangjianguo18, wanghaibin.wang

在 2023/6/2 14:52, Xiaoyao Li 写道:
> On 5/31/2023 8:00 PM, Yanan Wang wrote:
>> Currently, we only avoid emulating L3 cache properties for AMD CPU
>> when l3-cache is off, but failed to consider this case on CPUID 
>> 8000_001D.
>> This result in a fact that we will still have L3 caches in the VM
>> although we pass "host-cache-info=off,l3-cache=off" CLI to qemu.
>
> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Thanks.
>
> Out of curiosity, do you have a valid real use case to run VM with 
> "l3-cache = off"?
No, actually. This problem is found just in testing.

Yanan.
>
>> Fixes: 8f4202fb108 ("i386: Populate AMD Processor Cache Information 
>> for cpuid 0x8000001D")
>> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
>> ---
>>   target/i386/cpu.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
>> index 1242bd541a..17c367c5ba 100644
>> --- a/target/i386/cpu.c
>> +++ b/target/i386/cpu.c
>> @@ -6337,8 +6337,10 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t 
>> index, uint32_t count,
>>                                          &topo_info, eax, ebx, ecx, 
>> edx);
>>               break;
>>           case 3: /* L3 cache info */
>> - encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
>> -                                       &topo_info, eax, ebx, ecx, edx);
>> +            if (cpu->enable_l3_cache) {
>> + encode_cache_cpuid8000001d(env->cache_info_amd.l3_cache,
>> +                                           &topo_info, eax, ebx, 
>> ecx, edx);
>> +            }
>>               break;
>>           default: /* end of info */
>>               *eax = *ebx = *ecx = *edx = 0;
>
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-09  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 12:00 [PATCH] i386/cpu: Don't emulate L3 cache on 8000_001D if l3-cache is disabled Yanan Wang via
2023-06-02  6:52 ` Xiaoyao Li
2023-06-09  8:14   ` wangyanan (Y) via

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.