Re: [kvm-unit-tests PATCH 7/8] s390x: uv-host: Properly handle config creation errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/23/23 14:19, Nico Boehr wrote:
Quoting Janosch Frank (2023-03-23 11:39:12)
[...]
diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index d92571b5..b23d51c9 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -370,6 +370,38 @@ static void test_cpu_create(void)
         report_prefix_pop();
  }
+/*
+ * If the first bit of the rc is set we need to destroy the
+ * configuration before testing other create config errors.
+ */
+static void cgc_destroy_if_needed(struct uv_cb_cgc *uvcb)

Is there a reason why we can't make this a cgc_uv_call() function which performs the uv_call and the cleanups if needed?

I'd much rather put the destroy into the cleanup area after the report.


Mixing reports and cleanup activity feels a bit odd to me.

[...]
+/* This function expects errors, not successes */

I am confused by this comment. What does it mean?

+static bool cgc_check_data(struct uv_cb_cgc *uvcb, uint16_t rc_expected)

Rename to cgc_check_rc_and_handle?

+{
+       cgc_destroy_if_needed(uvcb);
+       /*
+        * We should only receive a handle when the rc is 1 or the
+        * first bit is set.

Where is the code that checks for rc == 1?

Ah OK, so that's what you mean with the comment above, this function only works if the UVC fails, right?

+        */
+       if (!(uvcb->header.rc & UVC_RC_DSTR_NEEDED_FLG) && uvcb->guest_handle)
+               return false;

It would be nicer if I got a proper report message that tells me that we got a handle even though we shouldn't destroy.

We can report_info() or report_abort().



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux