[PATCH v3] vhost/crypto: fix build with GCC 12

Poczatek, Jakub jakub.poczatek at intel.com
Wed Jun 22 17:21:47 CEST 2022


Hey David, 

The code change fixes the errors and the performance test completes. 

Kind Regards, 
Jakub Poczatek

-----Original Message-----
From: David Marchand <david.marchand at redhat.com> 
Sent: Wednesday 22 June 2022 15:08
To: Poczatek, Jakub <jakub.poczatek at intel.com>; Zhang, Roy Fan <roy.fan.zhang at intel.com>
Cc: Maxime Coquelin <maxime.coquelin at redhat.com>; dev at dpdk.org; stable at dpdk.org; Xia, Chenbo <chenbo.xia at intel.com>
Subject: Re: [PATCH v3] vhost/crypto: fix build with GCC 12

Hello Jakub, Roy,

On Wed, Jun 22, 2022 at 11:01 AM Poczatek, Jakub <jakub.poczatek at intel.com> wrote:
> When running a Virtio performance test on a VM using VHost with this 
> patch applied, VHost gives the following error message:
>
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_FEATURES
> > VHOST_CONFIG: (/tmp/vhost) negotiated Virtio features: 0x0
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_MEM_TABLE
> > VHOST_CONFIG: (/tmp/vhost) guest memory region size: 0x80000000
> > VHOST_CONFIG: (/tmp/vhost)       guest physical addr: 0x0
> > VHOST_CONFIG: (/tmp/vhost)       guest virtual  addr: 0x7f17c0000000
> > VHOST_CONFIG: (/tmp/vhost)       host  virtual  addr: 0x7f94c0000000
> > VHOST_CONFIG: (/tmp/vhost)       mmap addr : 0x7f94c0000000
> > VHOST_CONFIG: (/tmp/vhost)       mmap size : 0x80000000
> > VHOST_CONFIG: (/tmp/vhost)       mmap align: 0x40000000
> > VHOST_CONFIG: (/tmp/vhost)       mmap off  : 0x0
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_VRING_NUM
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_VRING_BASE
> > VHOST_CONFIG: (/tmp/vhost) vring base idx:0 last_used_idx:0 last_avail_idx:0.
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_VRING_ADDR
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_VRING_KICK
> > VHOST_CONFIG: (/tmp/vhost) vring kick idx:0 file:37
> > VHOST_CONFIG: (/tmp/vhost) reallocated virtqueue on node 1
> > VHOST_CONFIG: (/tmp/vhost) reallocated device on node 1
> > VHOST_CONFIG: (/tmp/vhost) virtio is now ready for processing.
> > USER1: New Vhost-crypto Device /tmp/vhost, Device ID 0
> > VHOST_CONFIG: (/tmp/vhost) read message VHOST_USER_SET_VRING_CALL
> > VHOST_CONFIG: (/tmp/vhost) vring call idx:0 file:38
> > USER1: [VHOST-Crypto]: Session 1 created for vdev 0.
> > USER1: [VHOST-Crypto]: Incorrect virtio descriptor
> > USER1: [VHOST-Crypto]: Failed to process sym request
> > USER1: [VHOST-Crypto]: Incorrect virtio descriptor
> > USER1: [VHOST-Crypto]: Failed to process sym request

Could you test with the following snippet:

diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c index 96ffb82a5d..54946f46d9 100644
--- a/lib/vhost/vhost_crypto.c
+++ b/lib/vhost/vhost_crypto.c
@@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req *vc_req,
                        return -1;
                left -= copied;
                data = RTE_PTR_ADD(data, copied);
-               desc++;
-       } while (desc < head + max_n_descs && left != 0);
+       } while (left != 0 && ++desc < head + max_n_descs);

        if (unlikely(left != 0))
                return -1;


--
David Marchand



More information about the stable mailing list