DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fetch again ring_addrs address after NUMA reallocation
@ 2017-10-13  9:30 Maxime Coquelin
  2017-10-13  9:43 ` Jens Freimann
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2017-10-13  9:30 UTC (permalink / raw)
  To: dev, yliu, lei.a.yao; +Cc: jfreiman, thomas, Maxime Coquelin

In case of NUMA reallocation, the virtqueue struct is reallocated
on another socket, meaning that its address changes.

In translate_ring_addresses(), addr pointer was not fetched again
after the reallocation, so it pointed to freed memory.

This patch just fetch again addr pointer after the reallocation.

Reported-by: Yao, Lei A <lei.a.yao@intel.com>
Tested-by: Yao, Lei A <lei.a.yao@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 9acac6125..2416a0061 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -417,6 +417,7 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index)
 
 	dev = numa_realloc(dev, vq_index);
 	vq = dev->virtqueue[vq_index];
+	addr = &vq->ring_addrs;
 
 	vq->avail = (struct vring_avail *)(uintptr_t)ring_addr_to_vva(dev,
 			vq, addr->avail_user_addr, sizeof(struct vring_avail));
-- 
2.13.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fetch again ring_addrs address after NUMA reallocation
  2017-10-13  9:30 [dpdk-dev] [PATCH] vhost: fetch again ring_addrs address after NUMA reallocation Maxime Coquelin
@ 2017-10-13  9:43 ` Jens Freimann
  2017-10-13 19:31   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Freimann @ 2017-10-13  9:43 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, yliu, lei.a.yao, thomas

On Fri, Oct 13, 2017 at 09:30:21AM +0000, Maxime Coquelin wrote:
>In case of NUMA reallocation, the virtqueue struct is reallocated
>on another socket, meaning that its address changes.
>
>In translate_ring_addresses(), addr pointer was not fetched again
>after the reallocation, so it pointed to freed memory.
>
>This patch just fetch again addr pointer after the reallocation.
>
>Reported-by: Yao, Lei A <lei.a.yao@intel.com>
>Tested-by: Yao, Lei A <lei.a.yao@intel.com>
>Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>---
> lib/librte_vhost/vhost_user.c | 1 +
> 1 file changed, 1 insertion(+)
>

Reviewed-by: Jens Freimann <jfreimann@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fetch again ring_addrs address after NUMA reallocation
  2017-10-13  9:43 ` Jens Freimann
@ 2017-10-13 19:31   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-10-13 19:31 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, Jens Freimann, yliu, lei.a.yao

13/10/2017 11:43, Jens Freimann:
> On Fri, Oct 13, 2017 at 09:30:21AM +0000, Maxime Coquelin wrote:
> >In case of NUMA reallocation, the virtqueue struct is reallocated
> >on another socket, meaning that its address changes.
> >
> >In translate_ring_addresses(), addr pointer was not fetched again
> >after the reallocation, so it pointed to freed memory.
> >
> >This patch just fetch again addr pointer after the reallocation.
> >
> >Reported-by: Yao, Lei A <lei.a.yao@intel.com>
> >Tested-by: Yao, Lei A <lei.a.yao@intel.com>
> >Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Reviewed-by: Jens Freimann <jfreimann@redhat.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-13 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13  9:30 [dpdk-dev] [PATCH] vhost: fetch again ring_addrs address after NUMA reallocation Maxime Coquelin
2017-10-13  9:43 ` Jens Freimann
2017-10-13 19:31   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).