From patchwork Tue Jul 23 10:03:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Cox X-Patchwork-Id: 1963715 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 4WSt5y1hZdz1yZw for ; Tue, 23 Jul 2024 20:04:05 +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 1sWCNC-0004GT-Fi; Tue, 23 Jul 2024 10:03:58 +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 1sWCNA-0004G9-Ph for kernel-team@lists.ubuntu.com; Tue, 23 Jul 2024 10:03:56 +0000 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (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 A82A83F13F for ; Tue, 23 Jul 2024 10:03:56 +0000 (UTC) Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52e9557e312so3837526e87.0 for ; Tue, 23 Jul 2024 03:03:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721729031; x=1722333831; 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=02DMlTG0yJ8UPXyX8FIgcIcCB3PuJwONui6+eeZH2/o=; b=wpPm/Egb9VadcVzUD4IAwtVox9dWeW+JnSV/NrEoF7vMHcUKbstyBbcpKduYwRa22r FQ9EsWwrM8AqK54IveIzaHV4hneebv2ZJ/aWinsjOq+vAm2ui+YEVZtYwt6fxhpoxhyQ BkU3mSyC/C2egQ30iNjmVCjuhyErrWB9npZC4q2K6go1tObTuapUxfoECRX1mkTmm0mY oEYOXhbv5runpqJVvAyy5u1pjsDwFIobS3uXrnbmhEIJADbN6J/w8KtzDglBeKbJiWme +a/R7/tIToG1XvT4v+qCeh0H6dTJYTBJZGKvdw/jNYGQr68qWGY8IQ4lI8XZbGyCI8pj rLZw== X-Gm-Message-State: AOJu0YxvdG81b0KPhDpu9SIAD5QZCQoqen5ssn7LeaFMCV4ALn6bp5tr 8QEnphCgiikElSj9+K3ZYIGt4xsBAgdjsQOWcGgZwUzIpTuzU456i3+V5+L6wn75vf0gkRAOv9d 9S9M4i/wfHn7KkNOUHxJd0XU6XoHWIFXG4jjMpTIvAx6HCqZVQ0SOCLwZFyflwkQfEwK4XBZSMA c/dDZjBQ4xw8AL X-Received: by 2002:a05:6512:683:b0:52e:9382:a36 with SMTP id 2adb3069b0e04-52efb7488f9mr6427458e87.30.1721729031071; Tue, 23 Jul 2024 03:03:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWghEEHno5obxXxIN0uM8Gad33yl67iKnKkz5bx0jnGwX7XdTAC0RwF4JgCjnKvQFt53fzuA== X-Received: by 2002:a05:6512:683:b0:52e:9382:a36 with SMTP id 2adb3069b0e04-52efb7488f9mr6427438e87.30.1721729030569; Tue, 23 Jul 2024 03:03:50 -0700 (PDT) Received: from cox.conference ([136.169.90.162]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52efd414f48sm1134496e87.208.2024.07.23.03.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 03:03:49 -0700 (PDT) From: Philip Cox To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] [n:linux-aws] net: ena: Fix redundant device NUMA node override Date: Tue, 23 Jul 2024 13:03:42 +0300 Message-Id: <20240723100342.54379-2-philip.cox@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723100342.54379-1-philip.cox@canonical.com> References: <20240723100342.54379-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. 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 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c index 4db689372980..3a5b307d5fb8 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,9 @@ 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 +404,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 +415,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,