Hi Salil,
On 10/12/23 10:04, Salil Mehta wrote:
On 12/10/2023 00:31, Gavin Shan wrote:
On 10/12/23 05:43, Salil Mehta wrote:
[...]
+void cpu_address_space_destroy(CPUState *cpu, int asidx)
+{
+ CPUAddressSpace *cpuas;
+
+ assert(asidx < cpu->num_ases);
+ assert(asidx == 0 || !kvm_enabled());
+ assert(cpu->cpu_ases);
+
The two asserts on @asidx and @cpu->cpu_ases can be combined
to one so that these 3 asserts can be combined to two.
/* Only one address space is supported by KVM */
assert(asidx == 0 || !kvm_enabled());
assert(asidx >= 0 && asidx < cpu->cpu_ases_count)
We can do that.
I am not in favor to remove 'assert(cpu->cpu_ases);' as this can save lot of
debugging.
Ok, It's fine to keep 'assert(cpu->cpu_ases)', but 'assert(asidx >= 0)' is
still needed? For example, the wrong chunk of memory will be release when
@asidx is smaller than zero, which is out-of-bound to @cpu->cpu_ases[]
Thanks,
Gavin