accel/kvm/kvm-all.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
During refactoring of kvm_irqchip_create(), the refactored code was returning
early from do_kvm_irqchip_create() function if the required capabilities were
not present in KVM. This was not translating to an early return from
kvm_irqchip_create() as was the case before refactoring. This is because,
do_kvm_irqchip_create() did not have a means to notify the caller of the lack
of kvm capabilities. Fix this by making do_notify_irqchip_create() return
EOPNOTSUPP error when required capabilities are absent and then the caller
can check the return code and return early.
Converted some calls to exit() to assertion checks in order to make it cleaner.
Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
Reported-by: Gautam Menghani <gautam@linux.ibm.com>
Suggested-by: Fabiano Rosas <farosas@suse.de>
Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
changelog:
v2: converted some exit() calls to assertions.
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 774499d34f..c78bf6a56f 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
}
-static void do_kvm_irqchip_create(KVMState *s)
+static int do_kvm_irqchip_create(KVMState *s)
{
int ret;
if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
@@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
exit(1);
}
} else {
- return;
+ /*
+ * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
+ * present. Bail.
+ */
+ return -EOPNOTSUPP;
}
- if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
- fprintf(stderr, "kvm: irqfd not implemented\n");
- exit(1);
- }
+ assert(kvm_check_extension(s, KVM_CAP_IRQFD));
/* First probe and see if there's a arch-specific hook to create the
* in-kernel irqchip for us */
ret = kvm_arch_irqchip_create(s);
if (ret == 0) {
- if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
- error_report("Split IRQ chip mode not supported.");
- exit(1);
- } else {
- ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
- }
+ /* assert that split IRQ chip mode is supported. */
+ assert(s->kernel_irqchip_split != ON_OFF_AUTO_ON);
+ ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
}
if (ret < 0) {
fprintf(stderr, "Create kernel irqchip failed: %s\n", strerror(-ret));
exit(1);
}
+
+ return 0;
}
static void kvm_irqchip_create(KVMState *s)
{
assert(s->kernel_irqchip_split != ON_OFF_AUTO_AUTO);
- do_kvm_irqchip_create(s);
+ if (do_kvm_irqchip_create(s) < 0) {
+ return;
+ }
kvm_kernel_irqchip = true;
/* If we have an in-kernel IRQ chip then we must have asynchronous
* interrupt delivery (though the reverse is not necessarily true)
@@ -2835,6 +2837,7 @@ static int kvm_reset_vmfd(MachineState *ms)
}
if (s->kernel_irqchip_allowed) {
+ /* ignore return from this function */
do_kvm_irqchip_create(s);
}
--
2.49.0
On 13/04/26 4:51 pm, Ani Sinha wrote:
> During refactoring of kvm_irqchip_create(), the refactored code was returning
> early from do_kvm_irqchip_create() function if the required capabilities were
> not present in KVM. This was not translating to an early return from
> kvm_irqchip_create() as was the case before refactoring. This is because,
> do_kvm_irqchip_create() did not have a means to notify the caller of the lack
> of kvm capabilities. Fix this by making do_notify_irqchip_create() return
> EOPNOTSUPP error when required capabilities are absent and then the caller
> can check the return code and return early.
>
> Converted some calls to exit() to assertion checks in order to make it cleaner.
>
> Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
> Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
> Reported-by: Gautam Menghani <gautam@linux.ibm.com>
> Suggested-by: Fabiano Rosas <farosas@suse.de>
> Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
> ---
> accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
> 1 file changed, 16 insertions(+), 13 deletions(-)
>
> changelog:
> v2: converted some exit() calls to assertions.
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 774499d34f..c78bf6a56f 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
> g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
> }
>
> -static void do_kvm_irqchip_create(KVMState *s)
> +static int do_kvm_irqchip_create(KVMState *s)
> {
> int ret;
> if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
> @@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
> exit(1);
> }
> } else {
> - return;
> + /*
> + * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
> + * present. Bail.
> + */
> + return -EOPNOTSUPP;
> }
>
> - if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
> - fprintf(stderr, "kvm: irqfd not implemented\n");
> - exit(1);
> - }
> + assert(kvm_check_extension(s, KVM_CAP_IRQFD));
again changing behaviour ?
previously it was doing exit(1) on returning non-zero.
Now, it will assert on returning zero ?
May be split the patch to keep the exit -> assert changes separate ?
>
> /* First probe and see if there's a arch-specific hook to create the
> * in-kernel irqchip for us */
> ret = kvm_arch_irqchip_create(s);
> if (ret == 0) {
> - if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
> - error_report("Split IRQ chip mode not supported.");
> - exit(1);
> - } else {
> - ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
> - }
> + /* assert that split IRQ chip mode is supported. */
> + assert(s->kernel_irqchip_split != ON_OFF_AUTO_ON);
> + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
> }
> if (ret < 0) {
> fprintf(stderr, "Create kernel irqchip failed: %s\n", strerror(-ret));
> exit(1);
> }
> +
> + return 0;
> }
>
> static void kvm_irqchip_create(KVMState *s)
> {
> assert(s->kernel_irqchip_split != ON_OFF_AUTO_AUTO);
>
> - do_kvm_irqchip_create(s);
> + if (do_kvm_irqchip_create(s) < 0) {
> + return;
> + }
> kvm_kernel_irqchip = true;
> /* If we have an in-kernel IRQ chip then we must have asynchronous
> * interrupt delivery (though the reverse is not necessarily true)
> @@ -2835,6 +2837,7 @@ static int kvm_reset_vmfd(MachineState *ms)
> }
>
> if (s->kernel_irqchip_allowed) {
> + /* ignore return from this function */
> do_kvm_irqchip_create(s);
> }
>
> On 13 Apr 2026, at 5:06 PM, Harsh Prateek Bora <harshpb@linux.ibm.com> wrote:
>
>
>
> On 13/04/26 4:51 pm, Ani Sinha wrote:
>> During refactoring of kvm_irqchip_create(), the refactored code was returning
>> early from do_kvm_irqchip_create() function if the required capabilities were
>> not present in KVM. This was not translating to an early return from
>> kvm_irqchip_create() as was the case before refactoring. This is because,
>> do_kvm_irqchip_create() did not have a means to notify the caller of the lack
>> of kvm capabilities. Fix this by making do_notify_irqchip_create() return
>> EOPNOTSUPP error when required capabilities are absent and then the caller
>> can check the return code and return early.
>> Converted some calls to exit() to assertion checks in order to make it cleaner.
>> Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
>> Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
>> Reported-by: Gautam Menghani <gautam@linux.ibm.com>
>> Suggested-by: Fabiano Rosas <farosas@suse.de>
>> Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>> Signed-off-by: Ani Sinha <anisinha@redhat.com>
>> ---
>> accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
>> 1 file changed, 16 insertions(+), 13 deletions(-)
>> changelog:
>> v2: converted some exit() calls to assertions.
>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
>> index 774499d34f..c78bf6a56f 100644
>> --- a/accel/kvm/kvm-all.c
>> +++ b/accel/kvm/kvm-all.c
>> @@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
>> g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
>> }
>> -static void do_kvm_irqchip_create(KVMState *s)
>> +static int do_kvm_irqchip_create(KVMState *s)
>> {
>> int ret;
>> if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
>> @@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
>> exit(1);
>> }
>> } else {
>> - return;
>> + /*
>> + * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
>> + * present. Bail.
>> + */
>> + return -EOPNOTSUPP;
>> }
>> - if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
>> - fprintf(stderr, "kvm: irqfd not implemented\n");
>> - exit(1);
>> - }
>> + assert(kvm_check_extension(s, KVM_CAP_IRQFD));
>
> again changing behaviour ?
> previously it was doing exit(1) on returning non-zero.
Non-zero is the success case. It was doing exit() for returning <=0 case
> if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0)
> Now, it will assert on returning zero ?
> May be split the patch to keep the exit -> assert changes separate ?
>
>> /* First probe and see if there's a arch-specific hook to create the
>> * in-kernel irqchip for us */
>> ret = kvm_arch_irqchip_create(s);
>> if (ret == 0) {
>> - if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
>> - error_report("Split IRQ chip mode not supported.");
>> - exit(1);
>> - } else {
>> - ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
>> - }
>> + /* assert that split IRQ chip mode is supported. */
>> + assert(s->kernel_irqchip_split != ON_OFF_AUTO_ON);
>> + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
>> }
>> if (ret < 0) {
>> fprintf(stderr, "Create kernel irqchip failed: %s\n", strerror(-ret));
>> exit(1);
>> }
>> +
>> + return 0;
>> }
>> static void kvm_irqchip_create(KVMState *s)
>> {
>> assert(s->kernel_irqchip_split != ON_OFF_AUTO_AUTO);
>> - do_kvm_irqchip_create(s);
>> + if (do_kvm_irqchip_create(s) < 0) {
>> + return;
>> + }
>> kvm_kernel_irqchip = true;
>> /* If we have an in-kernel IRQ chip then we must have asynchronous
>> * interrupt delivery (though the reverse is not necessarily true)
>> @@ -2835,6 +2837,7 @@ static int kvm_reset_vmfd(MachineState *ms)
>> }
>> if (s->kernel_irqchip_allowed) {
>> + /* ignore return from this function */
>> do_kvm_irqchip_create(s);
>> }
>>
>
> On 13 Apr 2026, at 5:45 PM, Ani Sinha <anisinha@redhat.com> wrote:
>
>
>
>> On 13 Apr 2026, at 5:06 PM, Harsh Prateek Bora <harshpb@linux.ibm.com> wrote:
>>
>>
>>
>> On 13/04/26 4:51 pm, Ani Sinha wrote:
>>> During refactoring of kvm_irqchip_create(), the refactored code was returning
>>> early from do_kvm_irqchip_create() function if the required capabilities were
>>> not present in KVM. This was not translating to an early return from
>>> kvm_irqchip_create() as was the case before refactoring. This is because,
>>> do_kvm_irqchip_create() did not have a means to notify the caller of the lack
>>> of kvm capabilities. Fix this by making do_notify_irqchip_create() return
>>> EOPNOTSUPP error when required capabilities are absent and then the caller
>>> can check the return code and return early.
>>> Converted some calls to exit() to assertion checks in order to make it cleaner.
>>> Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
>>> Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
>>> Reported-by: Gautam Menghani <gautam@linux.ibm.com>
>>> Suggested-by: Fabiano Rosas <farosas@suse.de>
>>> Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>>> Signed-off-by: Ani Sinha <anisinha@redhat.com>
>>> ---
>>> accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
>>> 1 file changed, 16 insertions(+), 13 deletions(-)
>>> changelog:
>>> v2: converted some exit() calls to assertions.
>>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
>>> index 774499d34f..c78bf6a56f 100644
>>> --- a/accel/kvm/kvm-all.c
>>> +++ b/accel/kvm/kvm-all.c
>>> @@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
>>> g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
>>> }
>>> -static void do_kvm_irqchip_create(KVMState *s)
>>> +static int do_kvm_irqchip_create(KVMState *s)
>>> {
>>> int ret;
>>> if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
>>> @@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
>>> exit(1);
>>> }
>>> } else {
>>> - return;
>>> + /*
>>> + * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
>>> + * present. Bail.
>>> + */
>>> + return -EOPNOTSUPP;
>>> }
>>> - if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
>>> - fprintf(stderr, "kvm: irqfd not implemented\n");
>>> - exit(1);
>>> - }
>>> + assert(kvm_check_extension(s, KVM_CAP_IRQFD));
>>
>> again changing behaviour ?
>> previously it was doing exit(1) on returning non-zero.
>
> Non-zero is the success case. It was doing exit() for returning <=0 case
>
>> if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0)
Actually maybe I should make this clearer
int kvm_check_extension(KVMState *s, unsaigned int extension)
{
int ret;
ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, extension);
if (ret < 0) {
ret = 0;
}
return ret;
}
So non-zero positive value is success. 0 is unsupported. Also see https://docs.kernel.org/virt/kvm/api.html#kvm-check-extension
So asserting on non-zero is fine.
>
>
>> Now, it will assert on returning zero ?
>> May be split the patch to keep the exit -> assert changes separate ?
>>
>>> /* First probe and see if there's a arch-specific hook to create the
>>> * in-kernel irqchip for us */
>>> ret = kvm_arch_irqchip_create(s);
>>> if (ret == 0) {
>>> - if (s->kernel_irqchip_split == ON_OFF_AUTO_ON) {
>>> - error_report("Split IRQ chip mode not supported.");
>>> - exit(1);
>>> - } else {
>>> - ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
>>> - }
>>> + /* assert that split IRQ chip mode is supported. */
>>> + assert(s->kernel_irqchip_split != ON_OFF_AUTO_ON);
>>> + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP);
>>> }
>>> if (ret < 0) {
>>> fprintf(stderr, "Create kernel irqchip failed: %s\n", strerror(-ret));
>>> exit(1);
>>> }
>>> +
>>> + return 0;
>>> }
>>> static void kvm_irqchip_create(KVMState *s)
>>> {
>>> assert(s->kernel_irqchip_split != ON_OFF_AUTO_AUTO);
>>> - do_kvm_irqchip_create(s);
>>> + if (do_kvm_irqchip_create(s) < 0) {
>>> + return;
>>> + }
>>> kvm_kernel_irqchip = true;
>>> /* If we have an in-kernel IRQ chip then we must have asynchronous
>>> * interrupt delivery (though the reverse is not necessarily true)
>>> @@ -2835,6 +2837,7 @@ static int kvm_reset_vmfd(MachineState *ms)
>>> }
>>> if (s->kernel_irqchip_allowed) {
>>> + /* ignore return from this function */
>>> do_kvm_irqchip_create(s);
>>> }
On Mon, 13 Apr 2026 at 12:37, Harsh Prateek Bora <harshpb@linux.ibm.com> wrote:
>
>
>
> On 13/04/26 4:51 pm, Ani Sinha wrote:
> > During refactoring of kvm_irqchip_create(), the refactored code was returning
> > early from do_kvm_irqchip_create() function if the required capabilities were
> > not present in KVM. This was not translating to an early return from
> > kvm_irqchip_create() as was the case before refactoring. This is because,
> > do_kvm_irqchip_create() did not have a means to notify the caller of the lack
> > of kvm capabilities. Fix this by making do_notify_irqchip_create() return
> > EOPNOTSUPP error when required capabilities are absent and then the caller
> > can check the return code and return early.
> >
> > Converted some calls to exit() to assertion checks in order to make it cleaner.
> >
> > Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
> > Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
> > Reported-by: Gautam Menghani <gautam@linux.ibm.com>
> > Suggested-by: Fabiano Rosas <farosas@suse.de>
> > Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
> > Signed-off-by: Ani Sinha <anisinha@redhat.com>
> > ---
> > accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
> > 1 file changed, 16 insertions(+), 13 deletions(-)
> >
> > changelog:
> > v2: converted some exit() calls to assertions.
> >
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index 774499d34f..c78bf6a56f 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
> > g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
> > }
> >
> > -static void do_kvm_irqchip_create(KVMState *s)
> > +static int do_kvm_irqchip_create(KVMState *s)
> > {
> > int ret;
> > if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
> > @@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
> > exit(1);
> > }
> > } else {
> > - return;
> > + /*
> > + * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
> > + * present. Bail.
> > + */
> > + return -EOPNOTSUPP;
> > }
> >
> > - if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
> > - fprintf(stderr, "kvm: irqfd not implemented\n");
> > - exit(1);
> > - }
> > + assert(kvm_check_extension(s, KVM_CAP_IRQFD));
>
> again changing behaviour ?
> previously it was doing exit(1) on returning non-zero.
> Now, it will assert on returning zero ?
> May be split the patch to keep the exit -> assert changes separate ?
I think for 11.0 it's probably best to do the minimum necessary
change to fix the logic error introduced by 98884e0cc1. For
that I think the v1 of this patch is OK.
There do seem to be some cleanup opportunities that we
have here, but we can do those in 11.1.
-- PMM
> On 13 Apr 2026, at 5:31 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Mon, 13 Apr 2026 at 12:37, Harsh Prateek Bora <harshpb@linux.ibm.com> wrote:
>>
>>
>>
>> On 13/04/26 4:51 pm, Ani Sinha wrote:
>>> During refactoring of kvm_irqchip_create(), the refactored code was returning
>>> early from do_kvm_irqchip_create() function if the required capabilities were
>>> not present in KVM. This was not translating to an early return from
>>> kvm_irqchip_create() as was the case before refactoring. This is because,
>>> do_kvm_irqchip_create() did not have a means to notify the caller of the lack
>>> of kvm capabilities. Fix this by making do_notify_irqchip_create() return
>>> EOPNOTSUPP error when required capabilities are absent and then the caller
>>> can check the return code and return early.
>>>
>>> Converted some calls to exit() to assertion checks in order to make it cleaner.
>>>
>>> Fixes: 98884e0cc1 ("accel/kvm: add changes required to support KVM VM file descriptor change")
>>> Reported-by: Misbah Anjum N <misanjum@linux.ibm.com>
>>> Reported-by: Gautam Menghani <gautam@linux.ibm.com>
>>> Suggested-by: Fabiano Rosas <farosas@suse.de>
>>> Suggested-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>>> Signed-off-by: Ani Sinha <anisinha@redhat.com>
>>> ---
>>> accel/kvm/kvm-all.c | 29 ++++++++++++++++-------------
>>> 1 file changed, 16 insertions(+), 13 deletions(-)
>>>
>>> changelog:
>>> v2: converted some exit() calls to assertions.
>>>
>>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
>>> index 774499d34f..c78bf6a56f 100644
>>> --- a/accel/kvm/kvm-all.c
>>> +++ b/accel/kvm/kvm-all.c
>>> @@ -2575,7 +2575,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi)
>>> g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi));
>>> }
>>>
>>> -static void do_kvm_irqchip_create(KVMState *s)
>>> +static int do_kvm_irqchip_create(KVMState *s)
>>> {
>>> int ret;
>>> if (kvm_check_extension(s, KVM_CAP_IRQCHIP)) {
>>> @@ -2587,36 +2587,38 @@ static void do_kvm_irqchip_create(KVMState *s)
>>> exit(1);
>>> }
>>> } else {
>>> - return;
>>> + /*
>>> + * neither KVM_CAP_IRQCHIP nor KVM_CAP_S390_IRQCHIP capabilities are
>>> + * present. Bail.
>>> + */
>>> + return -EOPNOTSUPP;
>>> }
>>>
>>> - if (kvm_check_extension(s, KVM_CAP_IRQFD) <= 0) {
>>> - fprintf(stderr, "kvm: irqfd not implemented\n");
>>> - exit(1);
>>> - }
>>> + assert(kvm_check_extension(s, KVM_CAP_IRQFD));
>>
>> again changing behaviour ?
>> previously it was doing exit(1) on returning non-zero.
>> Now, it will assert on returning zero ?
>> May be split the patch to keep the exit -> assert changes separate ?
>
> I think for 11.0 it's probably best to do the minimum necessary
> change to fix the logic error introduced by 98884e0cc1. For
> that I think the v1 of this patch is OK.
Agreed.
>
> There do seem to be some cleanup opportunities that we
> have here, but we can do those in 11.1.
cool.
>
> -- PMM
© 2016 - 2026 Red Hat, Inc.