File xen.xentrace-next_record.patch of Package xen

From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Jun 2023 12:31:20 +0000
Subject: xentrace next_record

xen/trace: remove duplicate check for tb_init_done

The single caller of next_record already checked for
tb_init_done. The functions are called with t_lock
held. The call stack look like this:

__trace_var
  tb_init_done?
  insert_wrap_record
  insert_lost_records
    __insert_record
      next_record
        tb_init_done?

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 xen/common/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -504,25 +504,25 @@ static unsigned char *next_record(const struct t_buf *buf, uint32_t *next,
                                  unsigned char **next_page,
                                  uint32_t *offset_in_page)
 {
     u32 x = buf->prod, cons = buf->cons;
     uint16_t per_cpu_mfn_offset;
     uint32_t per_cpu_mfn_nr;
     uint32_t *mfn_list;
     uint32_t mfn;
     unsigned char *this_page;
 
     barrier(); /* must read buf->prod and buf->cons only once */
     *next = x;
-    if ( !tb_init_done || bogus(x, cons) )
+    if ( bogus(x, cons) )
         return NULL;
 
     if ( x >= data_size )
         x -= data_size;
 
     ASSERT(x < data_size);
 
     /* add leading header to get total offset of next record */
     x += sizeof(struct t_buf);
     *offset_in_page = x & ~PAGE_MASK;
 
     /* offset into array of mfns */
openSUSE Build Service is sponsored by