Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp445971lqp; Mon, 10 Jun 2024 08:45:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjf1xAzJZv5VYb9fPtseFfG062qNLj8OgtSQ9fe8hbritiHzImbd0Y2QqefCM4EQ+dYDh8W/8otLl6XmVZ52hxJ0FMnNaDW9FmpD84wA== X-Google-Smtp-Source: AGHT+IHRnLznJeceRZLHJpGEvB7vC/yTDaB5idQIehHLb51yZB3JgNfySnBbDuyNrjbksv7wBJMZ X-Received: by 2002:a05:6870:9114:b0:254:8a91:4b86 with SMTP id 586e51a60fabf-2548a916beemr6806004fac.1.1718034315094; Mon, 10 Jun 2024 08:45:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718034315; cv=pass; d=google.com; s=arc-20160816; b=ptcGBhSrmFN9Evspv18chMT38ZJrt6YwFExSrCkroxJU2iBxRIuwAd6NxJk1N8UsDU aKYRQ0oTukyjf0I2nBnycohaAZss3KilbY9ZLaj3vAk21PipLKpXJzQzV9vNFbWuCiWX xteO3hRjpWW6NlU1+Oevmn9eOSUPPbtseMT6fFw3wh0jD4zS1wGwWJ0o3rb48KXZMhZo H74i/NNFUARi3yaEGIK29mj4vb9FFbo6OwLpJ6Nuwo1DdiGutDeTFYDs+iC7D7jSePcc nEpq64KeWxZNj3lVI41gbglJz67FOQ/Q4W8HZ1RaWyAjSY5V+1ZRk5rqQjB6A9Sl2+Da PtVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=kSJHSw+59VGdzQRDgYY59n8hDxhwCVAS0ZOw3VrE8QE=; fh=Ky8gCDPm5ZOYfm93akrIyDRxhDbkTx+Vw1DvzmfXgjo=; b=GeiqF5p0D5wgI0xry83kSBJRDoHUICmmmK3YG6/MNPyFRpKC0moZnahEz9GcNIesWP DTks7xcp4GFuEIrhXkKfkicesvE9LhwroQPUfCQ0F6837bEyzgVr2nGeT3ok0Z3MoHiA lS/XI6YtUG7eLgoRCKF8ZD24eGnkXkis3JxTKjqmy2yvaoDrPX8jGk9gLYxy9r0RXP4J uO6P3JI1l2Dr57IO4JlTEiMmrerhzvAX1sObC213XSh9edxsWeWKxhTqDaJVtkgsmrsx RpNVr4t6Gba5z9QB/zvI/cX075/OiMjuKXwUT5ZR0gtSojN3xRrptQgHc2jS5gt4/Kqm jlwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VWn/11Ul"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208500-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-7958e68c292si325460585a.283.2024.06.10.08.45.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 08:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="VWn/11Ul"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-208500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208500-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B9A341C214C7 for ; Mon, 10 Jun 2024 15:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E10F11420D5; Mon, 10 Jun 2024 15:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VWn/11Ul" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D3AB13C3E6; Mon, 10 Jun 2024 15:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718034303; cv=none; b=D92HjTXZwUv+XrxfvyeZevmENLnGnrFXaozl8ESVOvFDZcz76cM2yVGyxRCtD2zXd4vXP1Af9ToTiZU6TIwJNabuo4tJXcCCjz4s9xc/7xCUuKWTQRkZ9CKZTSY23aV8MV1Y8dAzIXJuh/rgEW1zpqH4oU5KOs8L6jSUF7+kumY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718034303; c=relaxed/simple; bh=ds9g/JKEqawI/ajkSavWOl6Obm7xM2HBK3q/teNQHeQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ACs58CJNvdr/S5T3txQlRAb+A7V5f0LXiIip69Hi8gzzKefcgnoRsnKpq9uLQqQmBnKR1CfAPsiEkO3p2sXO+gH4IdLNwnTKVsa5m3nbd+my1EbZG15LSvyO+cDooc426IqxdE82SFamYvEWZELUICCRb+c9XrrOiuyPyg3qAnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VWn/11Ul; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718034301; x=1749570301; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ds9g/JKEqawI/ajkSavWOl6Obm7xM2HBK3q/teNQHeQ=; b=VWn/11Ul9DNMz5/EQxd2uxjzzOkShnIR7MSRgf2PgHQqVjw43+kjFJAo Krg4WH9mf1z7+va/jQUasj11Mj5RR9xVxJ5mbkmfG2sh718gsj9E+nR2e JQepmskEgcK1V0+eE8S0iJCcD447z7nZcJ9ZiYRCtla517qNwoOky1Ay/ IcQ5nafWFq7uIF+ZIXrz0nVFNyQEv3tWlmlq6ecO5lzqEzo0TgB4yO/+d 8jLIHOg3kNt1JlRfj14AmrIxNgydQqzhsoYJ7FdLXsm6/8EI6rEsIjzUR IeVpfV7FE3zx7Hvs/QJPjOo+QANEDa6CocmE07A3MreAho9AqkQvhbN95 Q==; X-CSE-ConnectionGUID: psWTxMC2Sr2ReAiBFTdxBA== X-CSE-MsgGUID: 8pdGu4WxT22ze9YX4NAV0A== X-IronPort-AV: E=McAfee;i="6600,9927,11099"; a="26119830" X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="26119830" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2024 08:45:00 -0700 X-CSE-ConnectionGUID: YSJi+AyAS96z2cNVxtFXyg== X-CSE-MsgGUID: 5mxwVqsETaORA2iS9NgDPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,227,1712646000"; d="scan'208";a="43679757" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa004.fm.intel.com with ESMTP; 10 Jun 2024 08:44:55 -0700 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 4A7AE312D4; Mon, 10 Jun 2024 16:44:40 +0100 (IST) From: Larysa Zaremba To: intel-wired-lan@lists.osuosl.org Cc: Larysa Zaremba , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Maciej Fijalkowski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, magnus.karlsson@intel.com, Michal Kubiak Subject: [PATCH iwl-net 0/3] ice: fix synchronization between .ndo_bpf() and reset Date: Mon, 10 Jun 2024 17:37:12 +0200 Message-ID: <20240610153716.31493-1-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix the problems that are triggered by tx_timeout and ice_xdp() calls, including both pool and program operations. PF reset can be triggered asynchronously, e.g. by tx_timeout. With some unfortunate timings both reset and .ndo_bpf will try to access and modify XDP rings at the same time, causing system crash, such as the one below: [ +1.999878] ice 0000:b1:00.0: Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring 14 [ +2.002992] ice 0000:b1:00.0: Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring 18 [Mar15 18:17] ice 0000:b1:00.0 ens801f0np0: NETDEV WATCHDOG: CPU: 38: transmit queue 14 timed out 80692736 ms [ +0.000093] ice 0000:b1:00.0 ens801f0np0: tx_timeout: VSI_num: 6, Q 14, NTC: 0x0, HW_HEAD: 0x0, NTU: 0x0, INT: 0x4000001 [ +0.000012] ice 0000:b1:00.0 ens801f0np0: tx_timeout recovery level 1, txqueue 14 [ +0.394718] ice 0000:b1:00.0: PTP reset successful [ +0.006184] BUG: kernel NULL pointer dereference, address: 0000000000000098 [ +0.000045] #PF: supervisor read access in kernel mode [ +0.000023] #PF: error_code(0x0000) - not-present page [ +0.000023] PGD 0 P4D 0 [ +0.000018] Oops: 0000 [#1] PREEMPT SMP NOPTI [ +0.000023] CPU: 38 PID: 7540 Comm: kworker/38:1 Not tainted 6.8.0-rc7 #1 [ +0.000031] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0014.082620210524 08/26/2021 [ +0.000036] Workqueue: ice ice_service_task [ice] [ +0.000183] RIP: 0010:ice_clean_tx_ring+0xa/0xd0 [ice] [...] [ +0.000013] Call Trace: [ +0.000016] [ +0.000014] ? __die+0x1f/0x70 [ +0.000029] ? page_fault_oops+0x171/0x4f0 [ +0.000029] ? schedule+0x3b/0xd0 [ +0.000027] ? exc_page_fault+0x7b/0x180 [ +0.000022] ? asm_exc_page_fault+0x22/0x30 [ +0.000031] ? ice_clean_tx_ring+0xa/0xd0 [ice] [ +0.000194] ice_free_tx_ring+0xe/0x60 [ice] [ +0.000186] ice_destroy_xdp_rings+0x157/0x310 [ice] [ +0.000151] ice_vsi_decfg+0x53/0xe0 [ice] [ +0.000180] ice_vsi_rebuild+0x239/0x540 [ice] [ +0.000186] ice_vsi_rebuild_by_type+0x76/0x180 [ice] [ +0.000145] ice_rebuild+0x18c/0x840 [ice] [ +0.000145] ? delay_tsc+0x4a/0xc0 [ +0.000022] ? delay_tsc+0x92/0xc0 [ +0.000020] ice_do_reset+0x140/0x180 [ice] [ +0.000886] ice_service_task+0x404/0x1030 [ice] [ +0.000824] process_one_work+0x171/0x340 [ +0.000685] worker_thread+0x277/0x3a0 [ +0.000675] ? preempt_count_add+0x6a/0xa0 [ +0.000677] ? _raw_spin_lock_irqsave+0x23/0x50 [ +0.000679] ? __pfx_worker_thread+0x10/0x10 [ +0.000653] kthread+0xf0/0x120 [ +0.000635] ? __pfx_kthread+0x10/0x10 [ +0.000616] ret_from_fork+0x2d/0x50 [ +0.000612] ? __pfx_kthread+0x10/0x10 [ +0.000604] ret_from_fork_asm+0x1b/0x30 [ +0.000604] Larysa Zaremba (3): ice: synchronize XDP setup with reset ice: fix locking in ice_xsk_pool_setup() ice: make NAPI setting code aware that rtnl-locked request is waiting drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 23 ++++++++++--- drivers/net/ethernet/intel/ice/ice_main.c | 39 ++++++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_xsk.c | 12 ++----- 4 files changed, 57 insertions(+), 19 deletions(-) -- 2.43.0