File xen.trc-vcpu_ioreq_handle_completion.patch of Package xen

From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 15 Jun 2023 08:41:05 +0000
Subject: trc vcpu_ioreq_handle_completion

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 xen/common/ioreq.c | 17 ++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -273,28 +273,38 @@ static bool wait_for_io(struct ioreq_vcpu *sv, ioreq_t *p)
     sv->pending = false;
 
     return true;
 }
 
 bool vcpu_ioreq_handle_completion(struct vcpu *v)
 {
     struct vcpu_io *vio = &v->io;
     struct ioreq_server *s;
     struct ioreq_vcpu *sv;
     enum vio_completion completion;
     bool res = true;
+    trc_vcpu_ioreq_handle_completion_t trc = {
+        .d = v->domain->domain_id,
+        .v = v->vcpu_id,
+        .completion = vio->completion,
+        .state = vio->req.state,
+    };
+    TRACE_trc(TRC_IOREQ_vcpu_ioreq_handle_completion);
 
     while ( (sv = get_pending_vcpu(v, &s)) != NULL )
         if ( !wait_for_io(sv, get_ioreq(s, v)) )
-            return false;
+        {
+            res = false;
+            goto out;
+        }
 
     vio->req.state = ioreq_needs_completion(&vio->req) ?
         STATE_IORESP_READY : STATE_IOREQ_NONE;
 
     msix_write_completion(v);
     vcpu_end_shutdown_deferral(v);
 
     completion = vio->completion;
     vio->completion = VIO_no_completion;
 
     switch ( completion )
     {
@@ -313,24 +323,29 @@ bool vcpu_ioreq_handle_completion(struct vcpu *v)
     default:
         res = arch_vcpu_ioreq_completion(completion);
         break;
     }
 
     if ( res && unlikely(v->mapcache_invalidate) )
     {
         v->mapcache_invalidate = false;
         ioreq_signal_mapcache_invalidate();
         res = false;
     }
 
+out:
+    trc.out = true;
+    trc.res = res;
+    trc.state = vio->req.state;
+    TRACE_trc(TRC_IOREQ_vcpu_ioreq_handle_completion);
     return res;
 }
 
 static int ioreq_server_alloc_mfn(struct ioreq_server *s, bool buf)
 {
     struct ioreq_page *iorp = buf ? &s->bufioreq : &s->ioreq;
     struct page_info *page;
 
     if ( iorp->page )
     {
         /*
          * If a guest frame has already been mapped (which may happen
openSUSE Build Service is sponsored by