|
From: | Gavin Shan |
Subject: | Re: [PATCH V5 8/9] physmem: Add helper function to destroy CPU AddressSpace |
Date: | Thu, 12 Oct 2023 10:18:14 +1000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |