Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/641240/?format=api
{ "id": 641240, "url": "http://patchwork.ozlabs.org/api/patches/641240/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1467040603-23008-1-git-send-email-gpiccoli@linux.vnet.ibm.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1467040603-23008-1-git-send-email-gpiccoli@linux.vnet.ibm.com>", "list_archive_url": null, "date": "2016-06-27T15:16:43", "name": "[net] i40e: use valid online CPU on q_vector initialization", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "39dc4bb08e6eba22147e96ae5b551cfc443aeb69", "submitter": { "id": 67066, "url": "http://patchwork.ozlabs.org/api/people/67066/?format=api", "name": "Guilherme G. Piccoli", "email": "gpiccoli@linux.vnet.ibm.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1467040603-23008-1-git-send-email-gpiccoli@linux.vnet.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/641240/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/641240/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rdhvP3t28z9sdg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 28 Jun 2016 07:31:12 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 118BD95469;\n\tMon, 27 Jun 2016 21:31:11 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 8sH6oJpuHy7D; Mon, 27 Jun 2016 21:31:09 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 846B395441;\n\tMon, 27 Jun 2016 21:31:09 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3D73F1C1F19\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 15:17:05 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 2250932FBA\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 15:17:05 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 4WFtxxdPqbM3 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 15:16:57 +0000 (UTC)", "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 921D532F87\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 15:16:57 +0000 (UTC)", "from pps.filterd (m0098416.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id\n\tu5RF9BwV139140 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 11:16:56 -0400", "from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 23skjym4jm-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 11:16:56 -0400", "from localhost\n\tby e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <intel-wired-lan@lists.osuosl.org> from\n\t<gpiccoli@linux.vnet.ibm.com>; Mon, 27 Jun 2016 12:16:51 -0300", "from d24dlp01.br.ibm.com (9.18.248.204)\n\tby e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tMon, 27 Jun 2016 12:16:50 -0300", "from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16])\n\tby d24dlp01.br.ibm.com (Postfix) with ESMTP id 4B0C3352006E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 11:16:33 -0400 (EDT)", "from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97])\n\tby d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tu5RFGoSH4722942 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 12:16:50 -0300", "from d24av04.br.ibm.com (localhost [127.0.0.1])\n\tby d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tu5RFGnol029825 for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jun 2016 12:16:49 -0300", "from localhost ([9.18.200.94])\n\tby d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tu5RFGnwJ029807; Mon, 27 Jun 2016 12:16:49 -0300" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-IBM-Helo": "d24dlp01.br.ibm.com", "X-IBM-MailFrom": "gpiccoli@linux.vnet.ibm.com", "X-IBM-RcptTo": "intel-wired-lan@lists.osuosl.org", "From": "\"Guilherme G. Piccoli\" <gpiccoli@linux.vnet.ibm.com>", "To": "jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org", "Date": "Mon, 27 Jun 2016 12:16:43 -0300", "X-Mailer": "git-send-email 2.1.0", "X-TM-AS-MML": "disable", "X-Content-Scanned": "Fidelis XPS MAILER", "x-cbid": "16062715-0032-0000-0000-0000025E2254", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "16062715-0033-0000-0000-00000E91EC3B", "Message-Id": "<1467040603-23008-1-git-send-email-gpiccoli@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2016-06-27_10:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000\n\tdefinitions=main-1606270159", "X-Mailman-Approved-At": "Mon, 27 Jun 2016 21:31:09 +0000", "Cc": "netdev@vger.kernel.org, gpiccoli@linux.vnet.ibm.com", "Subject": "[Intel-wired-lan] [PATCH net] i40e: use valid online CPU on\n\tq_vector initialization", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Currently, the q_vector initialization routine sets the affinity_mask\nof a q_vector based on v_idx value. Meaning a loop iterates on v_idx,\nwhich is an incremental value, and the cpumask is created based on\nthis value.\n\nThis is a problem in systems with multiple logical CPUs per core (like in\nSMT scenarios). If we disable some logical CPUs, by turning SMT off for\nexample, we will end up with a sparse cpu_online_mask, i.e., only the first\nCPU in a core is online, and incremental filling in q_vector cpumask might\nlead to multiple offline CPUs being assigned to q_vectors.\n\nExample: if we have a system with 8 cores each one containing 8 logical\nCPUs (SMT == 8 in this case), we have 64 CPUs in total. But if SMT is\ndisabled, only the 1st CPU in each core remains online, so the\ncpu_online_mask in this case would have only 8 bits set, in a sparse way.\n\nIn general case, when SMT is off the cpu_online_mask has only C bits set:\n0, 1*N, 2*N, ..., C*(N-1) where\nC == # of cores;\nN == # of logical CPUs per core.\nIn our example, only bits 0, 8, 16, 24, 32, 40, 48, 56 would be set.\n\nThis patch changes the way q_vector's affinity_mask is created: it iterates\non v_idx, but consumes the CPU index from the cpu_online_mask instead of\njust using the v_idx incremental value.\n\nNo functional changes were introduced.\n\nSigned-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>\n---\n drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +++++++++++-----\n 1 file changed, 11 insertions(+), 5 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c\nindex 5ea2200..a89bddd 100644\n--- a/drivers/net/ethernet/intel/i40e/i40e_main.c\n+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c\n@@ -7726,10 +7726,11 @@ static int i40e_init_msix(struct i40e_pf *pf)\n * i40e_vsi_alloc_q_vector - Allocate memory for a single interrupt vector\n * @vsi: the VSI being configured\n * @v_idx: index of the vector in the vsi struct\n+ * @cpu: cpu to be used on affinity_mask\n *\n * We allocate one q_vector. If allocation fails we return -ENOMEM.\n **/\n-static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)\n+static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx, int cpu)\n {\n \tstruct i40e_q_vector *q_vector;\n \n@@ -7740,7 +7741,8 @@ static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)\n \n \tq_vector->vsi = vsi;\n \tq_vector->v_idx = v_idx;\n-\tcpumask_set_cpu(v_idx, &q_vector->affinity_mask);\n+\tcpumask_set_cpu(cpu, &q_vector->affinity_mask);\n+\n \tif (vsi->netdev)\n \t\tnetif_napi_add(vsi->netdev, &q_vector->napi,\n \t\t\t i40e_napi_poll, NAPI_POLL_WEIGHT);\n@@ -7764,8 +7766,7 @@ static int i40e_vsi_alloc_q_vector(struct i40e_vsi *vsi, int v_idx)\n static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi)\n {\n \tstruct i40e_pf *pf = vsi->back;\n-\tint v_idx, num_q_vectors;\n-\tint err;\n+\tint err, v_idx, num_q_vectors, current_cpu;\n \n \t/* if not MSIX, give the one vector only to the LAN VSI */\n \tif (pf->flags & I40E_FLAG_MSIX_ENABLED)\n@@ -7775,10 +7776,15 @@ static int i40e_vsi_alloc_q_vectors(struct i40e_vsi *vsi)\n \telse\n \t\treturn -EINVAL;\n \n+\tcurrent_cpu = cpumask_first(cpu_online_mask);\n+\n \tfor (v_idx = 0; v_idx < num_q_vectors; v_idx++) {\n-\t\terr = i40e_vsi_alloc_q_vector(vsi, v_idx);\n+\t\terr = i40e_vsi_alloc_q_vector(vsi, v_idx, current_cpu);\n \t\tif (err)\n \t\t\tgoto err_out;\n+\t\tcurrent_cpu = cpumask_next(current_cpu, cpu_online_mask);\n+\t\tif (unlikely(current_cpu >= nr_cpu_ids))\n+\t\t\tcurrent_cpu = cpumask_first(cpu_online_mask);\n \t}\n \n \treturn 0;\n", "prefixes": [ "net" ] }