Re: [PATCH v1 07/17] xen/riscv: introduce vCPU AIA initialization
Jan Beulich <[email protected]>
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <[email protected]> |
On 13.08.2026 11:24, Baptiste Le Duc wrote:
>> --- a/xen/arch/riscv/aia.c
>> +++ b/xen/arch/riscv/aia.c
>> @@ -14,6 +14,7 @@
>> #include <asm/cpufeature.h>
>> #include <asm/csr.h>
>> #include <asm/current.h>
>> +#include <asm/imsic.h>
>>
>> struct vgein_ctrl {
>> unsigned long bmp;
>> @@ -36,6 +37,35 @@ bool aia_usable(void)
>> return _aia_usable;
>> }
>>
>> +void vcpu_aia_init(struct vcpu *v)
>> +{
>> + unsigned int new_vsfile_id;
>> + int rc;
>> +
>> + if ( !aia_usable() )
>> + return;
>> +
>> + new_vsfile_id = vgein_assign(v);
>> +
>> + /*
>> + * vgein_assign() returns 0 when no free h/w guest interrupt file is
>> + * available (including GEILEN == 0); imsic_map_guest_file() maps nothing
>> + * in that case.
>> + */
>> + rc = imsic_map_guest_file(v, new_vsfile_id);
>> + if ( rc )
>> + {
>> + /* Can't continue w/o correctly mapped IMSIC interrupt file */
>> + domain_crash(v->domain);
>
> The vgein id assigned a few lines up is not released here. The domain is dying
> anyway, but the guest interrupt file stays marked in use on that pCPU forever,
> since nothing else ever calls vgein_release(). A vgein_release(v,
> new_vsfile_id) before the domain_crash() would fix it.
Instead of (or in addition to) doing that here, wouldn't releasing better be part
of the normal cleanup path? Whether "instead of" or "in addition to" depends on
the implications of deferring the release. But to guarantee no leak, domain
cleanup will want to either do the release, or have an explicit check that is was
done.
Jan