From patchwork Wed Jul 24 12:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Cox X-Patchwork-Id: 1964266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WTYFM0fpkz1yZw for ; Wed, 24 Jul 2024 22:27:51 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sWb5u-0000Ma-0F; Wed, 24 Jul 2024 12:27:46 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sWb5r-0000KI-Oj for kernel-team@lists.ubuntu.com; Wed, 24 Jul 2024 12:27:43 +0000 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 3C889400B0 for ; Wed, 24 Jul 2024 12:27:41 +0000 (UTC) Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52efd58cc5dso5462188e87.1 for ; Wed, 24 Jul 2024 05:27:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721824059; x=1722428859; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qpuUXrAFjnbvd2ZTcsYhdxq6OyM1msCsLMi5yVEbIdQ=; b=goMdB//j0Y/N+XHIFKekjjBDG6jThsf4gdEEmlIDC0BrHybpdBN9GRKaDk2kn2LKFd qDJEfOtRCc7Q63i+fJA4RHlu3rc3MlvkxSerVP7mQUdvT65z4YECm0IvNhJ4bHIzB185 wSJPZOLPdHnJf4l4hM0W/Dyrm6Kq0EKNFidbxjEYp7uk7auwzdSvH8u+5I2+uyxd3ej6 GCBB6/2BbQK4pM25Ub/R4Vo8s5w7omSbskVdgvkDIkaOK5fZRTIqdV5NJmpZhUfVIxzA /mIcpXFAHbeVP/T7EOdShF5+WptXr89hu0XIyAPrcjtBNeEVva/TmZXWVNuY/GlTASOi d9uw== X-Gm-Message-State: AOJu0YwF76sVmIsUC/gt/hAlwTv6/fBZY0zg4bNBahKLV9jxRkT7uASU 29J46A2ylcp77jx3eMjiGeW5vMw0F7rnYoh2pqdYghuoUBlKvpHCer3icEsb1kamXQ1azd8YRpp 4ggmUfmh3IVnmpnYJ0ZmMFBaZ19AzG852OgouePJfWT1i8vcoMK8UmJVTcPj7unjzJeBPx9+epi 0JV6L2KsjHplTg X-Received: by 2002:a05:6512:2256:b0:52e:be2c:4b05 with SMTP id 2adb3069b0e04-52fceff2b10mr1547558e87.21.1721824058949; Wed, 24 Jul 2024 05:27:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyWviSgrnJcJDVCT9OLwDmhmRyMAQRHccph3GElkDtdj4tfki2Q9dbmiZGmrD047WILfPG4w== X-Received: by 2002:a05:6512:2256:b0:52e:be2c:4b05 with SMTP id 2adb3069b0e04-52fceff2b10mr1547542e87.21.1721824058473; Wed, 24 Jul 2024 05:27:38 -0700 (PDT) Received: from cox.conference ([136.169.90.162]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f01d9d5ebsm1235588e87.243.2024.07.24.05.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 05:27:34 -0700 (PDT) From: Philip Cox To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][aws][v2] net: ena: Fix redundant device NUMA node override Date: Wed, 24 Jul 2024 15:26:25 +0300 Message-Id: <20240724122625.376350-2-philip.cox@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724122625.376350-1-philip.cox@canonical.com> References: <20240724122625.376350-1-philip.cox@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Shay Agroskin BugLink: https://bugs.launchpad.net/bugs/2067516 The driver overrides the NUMA node id of the device regardless of whether it knows its correct value (often setting it to -1 even though the node id is advertised in 'struct device'). This can lead to suboptimal configurations. This patch fixes this behavior and makes the shared memory allocation functions use the NUMA node id advertised by the underlying device. v2: remove dupliate devm_kzalloc() call in ena_com_init_io_sq() Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") Signed-off-by: Shay Agroskin Link: https://lore.kernel.org/r/20240528170912.1204417-1-shayagr@amazon.com Signed-off-by: Jakub Kicinski (backported from commit 2dc8b1e7177d4f49f492ce648440caf2de0c3616) [philcox: context changes in ena_com_init_io_cq() and ena_com_init_io_sq()] Signed-off-by: Philip Cox --- drivers/net/ethernet/amazon/ena/ena_com.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c index 4db689372980..b069099d1272 100644 --- a/drivers/net/ethernet/amazon/ena/ena_com.c +++ b/drivers/net/ethernet/amazon/ena/ena_com.c @@ -320,7 +320,6 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, struct ena_com_io_sq *io_sq) { size_t size; - int dev_node = 0; memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr)); @@ -333,13 +332,10 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, size = io_sq->desc_entry_size * io_sq->q_depth; if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) { - dev_node = dev_to_node(ena_dev->dmadev); - set_dev_node(ena_dev->dmadev, ctx->numa_node); io_sq->desc_addr.virt_addr = dma_alloc_coherent(ena_dev->dmadev, size, &io_sq->desc_addr.phys_addr, GFP_KERNEL); - set_dev_node(ena_dev->dmadev, dev_node); if (!io_sq->desc_addr.virt_addr) { io_sq->desc_addr.virt_addr = dma_alloc_coherent(ena_dev->dmadev, size, @@ -365,11 +361,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev, size = (size_t)io_sq->bounce_buf_ctrl.buffer_size * io_sq->bounce_buf_ctrl.buffers_num; - dev_node = dev_to_node(ena_dev->dmadev); - set_dev_node(ena_dev->dmadev, ctx->numa_node); - io_sq->bounce_buf_ctrl.base_buffer = - devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); - set_dev_node(ena_dev->dmadev, dev_node); + io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); if (!io_sq->bounce_buf_ctrl.base_buffer) io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL); @@ -410,7 +402,6 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev, struct ena_com_io_cq *io_cq) { size_t size; - int prev_node = 0; memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr)); @@ -422,12 +413,9 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev, size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth; - prev_node = dev_to_node(ena_dev->dmadev); - set_dev_node(ena_dev->dmadev, ctx->numa_node); io_cq->cdesc_addr.virt_addr = dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr, GFP_KERNEL); - set_dev_node(ena_dev->dmadev, prev_node); if (!io_cq->cdesc_addr.virt_addr) { io_cq->cdesc_addr.virt_addr = dma_alloc_coherent(ena_dev->dmadev, size,