From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 66046201 for ; Tue, 27 Nov 2018 14:29:37 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id b7so8367235pfi.8 for ; Tue, 27 Nov 2018 05:29:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BPwVHgx7KsVQm7RDULc24rTYBPLmB5QDX+1ytvHMmWU=; b=PO/lss6ulZ9KroNVOIq3jT6PT+p9OohNDtdXkmLB0bCxC0pbgx8H8X5+I5GffHrjoB P3QrokZalcAofHoRyF55AZuzt5TtGaR120ynRDLEyMDZ3xT6BpnI2pcQkY0VHaP3y1P0 av8BE36vW630tHfZoYXnvSuLsScJWR3PXkpEhGxRxClON/U4UVDiKJmf4JySCtnSyXJy AB5YdA0rC8aIV9FWSxOp01wRFZqGqXL3jRjCrJ+RAM+1og562BUm8180eYGvb3FqEg9B EuiXEnpdaWY/bBDzstnBSmv/57/daeDLuNT2ieXDFsRVgNyuj2UIFyPKa2BMQVRdaLpM 0r3Q== X-Gm-Message-State: AA+aEWabJG/hYuf2fjTHDflEjB4oa1aB43fY2VrzJ8U1q/6m2/Q1N/EE cAHY250uiYnFJS8Dc1IUmlXSib8bOGsVkZ0WkrqWPA== X-Google-Smtp-Source: AFSGD/Vco5aIK/z0KkDuf3uSeZdfiAc1WYNA43iDOtROahCCVSeGgbXrbBp31CHlYUL+7jxv9fqsDjGm5jhslfcFP34= X-Received: by 2002:a63:ca0a:: with SMTP id n10mr29420446pgi.258.1543325376569; Tue, 27 Nov 2018 05:29:36 -0800 (PST) MIME-Version: 1.0 References: <20181127105427.11641-1-maxime.coquelin@redhat.com> In-Reply-To: <20181127105427.11641-1-maxime.coquelin@redhat.com> From: David Marchand Date: Tue, 27 Nov 2018 14:29:24 +0100 Message-ID: To: maxime.coquelin@redhat.com Cc: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com, stable@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] net/virtio: allocate vrings on device NUMA node X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2018 13:29:37 -0000 On Tue, Nov 27, 2018 at 11:54 AM Maxime Coquelin wrote: > When a guest is spanned on multiple NUMA nodes and > multiple Virtio devices are spanned onto these nodes, > we expect that their ring memory is allocated in the > right memory node. > > Signed-off-by: Maxime Coquelin > --- > drivers/net/virtio/virtio_ethdev.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index 2ba66d291..d99571d93 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -335,8 +335,10 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > vtpci_queue_idx) > void *sw_ring = NULL; > int queue_type = virtio_get_queue_type(hw, vtpci_queue_idx); > int ret; > + int numa_node = dev->device->numa_node; > > - PMD_INIT_LOG(DEBUG, "setting up queue: %u", vtpci_queue_idx); > + PMD_INIT_LOG(INFO, "setting up queue: %u on NUMA node %u", > %d ? + vtpci_queue_idx, numa_node); > > /* > * Read the virtqueue size from the Queue Size field > @@ -372,7 +374,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > vtpci_queue_idx) > } > > vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE, > - SOCKET_ID_ANY); > + numa_node); > if (vq == NULL) { > PMD_INIT_LOG(ERR, "can not allocate vq"); > return -ENOMEM; > @@ -392,7 +394,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > vtpci_queue_idx) > size, vq->vq_ring_size); > > mz = rte_memzone_reserve_aligned(vq_name, vq->vq_ring_size, > - SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG, > + numa_node, RTE_MEMZONE_IOVA_CONTIG, > VIRTIO_PCI_VRING_ALIGN); > if (mz == NULL) { > if (rte_errno == EEXIST) > @@ -418,7 +420,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > vtpci_queue_idx) > snprintf(vq_hdr_name, sizeof(vq_hdr_name), > "port%d_vq%d_hdr", > dev->data->port_id, vtpci_queue_idx); > hdr_mz = rte_memzone_reserve_aligned(vq_hdr_name, > sz_hdr_mz, > - SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG, > + numa_node, RTE_MEMZONE_IOVA_CONTIG, > RTE_CACHE_LINE_SIZE); > if (hdr_mz == NULL) { > if (rte_errno == EEXIST) > @@ -435,7 +437,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t > vtpci_queue_idx) > sizeof(vq->sw_ring[0]); > > sw_ring = rte_zmalloc_socket("sw_ring", sz_sw, > - RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY); > + RTE_CACHE_LINE_SIZE, numa_node); > if (!sw_ring) { > PMD_INIT_LOG(ERR, "can not allocate RX soft ring"); > ret = -ENOMEM; > Reviewed-by: David Marchand -- David Marchand