From patchwork Thu Jan 4 17:12:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5745301dyb; Thu, 4 Jan 2024 09:14:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IENOjhiYSt3ULZsGMACF/S5yda2BYSo6q9FV9NkwZwA+Y+xrRRt9M+Vt7BjmcQhID5D3smd X-Received: by 2002:a05:651c:10ad:b0:2cd:1647:966 with SMTP id k13-20020a05651c10ad00b002cd16470966mr430017ljn.35.1704388454586; Thu, 04 Jan 2024 09:14:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388454; cv=pass; d=google.com; s=arc-20160816; b=rJpLmAyLYsV5zx4fQsz2KWZ1eZo7sBsku4Ibe3wVJAOh847O5xtVLQSGDrvQXDTyUj 0rp9HEi4Zq+pHt0xOWjrw9jgVyQkMie6kHUDYyFFJz+JKw2pTmPW4QZRLGbtAWvWdZ5i gVxUOqReirGUGPuu/GqSQrze/nswyp6Qqgi5Hp/v4GmIhuK7S3q8kcc2gcIpH2UGhwA1 4Z+TY3QvgO65SOH2ZMBtMfgTQVxMwLL2szco4STJCOHNQsrdmF7qTgmNOF0bJBDhdTNe GU161VaR5cDxeOcbBUAH/5Y4/i+8Sx5w6aMi7b9kxXWXNfKTXtuQTA9qlhbeknee8YnL tzfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1+dlkuWMJkvaR6JZQa8AmAvq+gqFp1jXyolnCqC28hI=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=r9uY7egO6v/jogD3uE0nPM6VUjlc4Y3oZNVAmCbe3h73BP8MpJjqO9nNhJCvHjfD1d bB82N6UNHljudHjcuSfbwhi5duzUelWHGwsPC3frZLtmZ70xeAtq8g9lqcJ1dCeL5QaA QKHo4jrJHQOAOO/jdFgF1s5760jEEplzox5sZC2Y2vcu+SV1sI+0n3LLPkAc8juyZTQj dhmXrboom/IcL8MGbFy6jvXtcGak2z1pIwEkunnVtScybAcKwS96w6nwkb7wG7S0BqOA FdprGgiI0y4OVl8hnwigjZFWto+5nMd7DhMkxjIJ6xtaTWAEIzsMWiOBTo1NQWNhvpD/ H9Lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CaQ5bIk7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16994-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16994-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y11-20020a056402358b00b005549114a1ebsi10983902edc.287.2024.01.04.09.14.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:14:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16994-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CaQ5bIk7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16994-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16994-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 am.mirrors.kernel.org (Postfix) with ESMTPS id F1C691F25433 for ; Thu, 4 Jan 2024 17:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 493E82C1BC; Thu, 4 Jan 2024 17:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CaQ5bIk7" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2087.outbound.protection.outlook.com [40.107.237.87]) (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 2C66C28E06; Thu, 4 Jan 2024 17:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBlVPBCMYFvtAWphm01tteO7Vp3Ui0lXj9XnRsqxBsLtcOItvCPy3se2efX1XhfJj7QCduo0OyKT5n3JYmKvQoy8u+ZXF/l/u8r+pqGdUkAog0mn5xEZJCU1aNhPnVb8nII6IIiPR7dQVRLNEtxTkvIPeYZDqUzBFNai79HhxCXMUuPdtcuALJf+/DFjSPpvW3xWKUVPICtgmUVkz51vqfuW1sx6if7hBU9eeKbZ+I6nY22P3+cAXzvtO8B3GRX5guAmo0CwfxoSKmnIaCdrgQ2eqqGVlX5AVx9ctF1ssk36JZfpeTbbBGjOLwMphoAmi00ppPtV6qWbgpbg7Ok7Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1+dlkuWMJkvaR6JZQa8AmAvq+gqFp1jXyolnCqC28hI=; b=Eq0VNoVdq2sUs3zqx9kB4PQ5mXfZXVnIVHYbi1WUfFzUuRM2Xw4p0SX+MLrKG0cNcOdtVGxB4u+G2zHhEXw/Rrpqfa7Kticc0KZyzYNPkKBfJzhGCJo4491MjmpxC6TPN9rwDRs84+Tbuh/ylilx//0YQZbEvzO2ZqOJBTkB+/4Hp1ILHIq7Z0AXhWmI7w5ngZ0hMveegJayxmCcf92L4+1uxkkTwMYP60TRoi4iW3lU6hnsghnudhC4fccauDIBNDZy0eOhlaltu8IQOExb82v0lzjKjz94lC0SrwLWLOHrf5nzB3udcXVAkMht3OfEMofagawp3r00SWGktFtv9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1+dlkuWMJkvaR6JZQa8AmAvq+gqFp1jXyolnCqC28hI=; b=CaQ5bIk7i7HrDBdPY86+A+OV2sbWn25l8m6Lj5tRq4A49Fthlo31BxAIwgeVZh4zQURiFVt0aHDAjbN2uPkTQ1ekCjiJ6iXAaQmwB4/JaxR60Cb1BmnXv2tuO8RY7+OB0QCxFsUmCETEZ5N/DS+X5Z47gew9omRV+D+y4rmMJnw= Received: from DS7PR03CA0240.namprd03.prod.outlook.com (2603:10b6:5:3ba::35) by SN7PR12MB6815.namprd12.prod.outlook.com (2603:10b6:806:265::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16; Thu, 4 Jan 2024 17:12:37 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::2c) by DS7PR03CA0240.outlook.office365.com (2603:10b6:5:3ba::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 17:12:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:36 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:35 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 1/8] pds_core: Prevent health thread from running during reset/remove Date: Thu, 4 Jan 2024 09:12:14 -0800 Message-ID: <20240104171221.31399-2-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|SN7PR12MB6815:EE_ X-MS-Office365-Filtering-Correlation-Id: 80ed67ce-8944-4aa4-f1ca-08dc0d48598b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y14mKHzwzMyoEl+RCQgmyCKFGNsnPmkxjznR43Ud7ycRlGJDkRZfrn9ALH6PMFGoKyKWmZNx/1nZm2yueHM7gNnuc3Gw7vMBpc5dlp1bKfWtBK1JTruvkacIFuxoK1PaTYfLeoGfrTHM1JxYuvkCcIosds5b53dD8XOohFyKBI43v4pFwqnvOrpIpy55dTsiZ/a3xqUix7Zl/IAFx2v3o1zhOOdKkimYhFyaViaG7dVEdJo5DeIJGFPt1mmOl56zC8Hjox3pfMQoP14sPbgem9iFNi5rWmOkF+FI5prwJDE5vug6D07wNC06Cx/GZ+BOnzgb74zZUMN1phoeGSUmJ6KxPUd9tODrAAFXsECS371HeZUjNgVGytQ6Uewj1cQ5q5yM8VH7GndORUAjpyuo1yTOjPM+OzI+zm7Rd0b5mDX8OlDJePwQ2nwCV2FlM3Oo5tAgXKAWusJtXvqQcXcr/Hc8NE7zABriYAKu2bYwe6MjIG2C+QGe4nw39+kuXK/FaTG4YYBW2DGfDANrWogXOq96xjEwBj/zVzU8rYzl+zKtajP2auhvvCQd1+ehg3FrnW2sNIXWwNY0ntfvMxzVw3yyZEYrM8Rhs6bEr0Rm2eLH1sO64rPIjq6vpjEUSfr5JmmdDyWgnEBu9mhnX+TrTw1ExasfRbs4ZKUB9kAspG8VGpW/lH1Y8KtKyRaprOQjjRikVaHfQ7keJGHNb3OzTe+nj+bD7hY1E4BAwOYLtE8E0VpmZMMt6Cv2o0g3m/EV8qLAz6OvTOzKQ8whY2T7SA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(64100799003)(82310400011)(1800799012)(186009)(451199024)(46966006)(36840700001)(40470700004)(44832011)(5660300002)(2906002)(356005)(8936002)(4326008)(8676002)(316002)(336012)(426003)(2616005)(16526019)(1076003)(83380400001)(81166007)(36860700001)(26005)(40480700001)(36756003)(40460700003)(82740400003)(86362001)(41300700001)(70586007)(6666004)(110136005)(478600001)(70206006)(47076005)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:36.9042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80ed67ce-8944-4aa4-f1ca-08dc0d48598b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6815 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180828388084298 X-GMAIL-MSGID: 1787180828388084298 The PCIe reset handlers can run at the same time as the health thread. This can cause the health thread to stomp on the PCIe reset. Fix this by preventing the health thread from running while a PCIe reset is happening. As part of this use timer_shutdown_sync() during reset and remove to make sure the timer doesn't ever get rearmed. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/main.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/main.c b/drivers/net/ethernet/amd/pds_core/main.c index 3080898d7b95..5172a5ad8ec6 100644 --- a/drivers/net/ethernet/amd/pds_core/main.c +++ b/drivers/net/ethernet/amd/pds_core/main.c @@ -293,7 +293,7 @@ static int pdsc_init_pf(struct pdsc *pdsc) err_out_teardown: pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING); err_out_unmap_bars: - del_timer_sync(&pdsc->wdtimer); + timer_shutdown_sync(&pdsc->wdtimer); if (pdsc->wq) destroy_workqueue(pdsc->wq); mutex_destroy(&pdsc->config_lock); @@ -420,7 +420,7 @@ static void pdsc_remove(struct pci_dev *pdev) */ pdsc_sriov_configure(pdev, 0); - del_timer_sync(&pdsc->wdtimer); + timer_shutdown_sync(&pdsc->wdtimer); if (pdsc->wq) destroy_workqueue(pdsc->wq); @@ -445,10 +445,24 @@ static void pdsc_remove(struct pci_dev *pdev) devlink_free(dl); } +static void pdsc_stop_health_thread(struct pdsc *pdsc) +{ + timer_shutdown_sync(&pdsc->wdtimer); + if (pdsc->health_work.func) + cancel_work_sync(&pdsc->health_work); +} + +static void pdsc_restart_health_thread(struct pdsc *pdsc) +{ + timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0); + mod_timer(&pdsc->wdtimer, jiffies + 1); +} + void pdsc_reset_prepare(struct pci_dev *pdev) { struct pdsc *pdsc = pci_get_drvdata(pdev); + pdsc_stop_health_thread(pdsc); pdsc_fw_down(pdsc); pci_free_irq_vectors(pdev); @@ -486,6 +500,7 @@ void pdsc_reset_done(struct pci_dev *pdev) } pdsc_fw_up(pdsc); + pdsc_restart_health_thread(pdsc); } static const struct pci_error_handlers pdsc_err_handler = { From patchwork Thu Jan 4 17:12:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185082 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5745351dyb; Thu, 4 Jan 2024 09:14:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQKXH9HXJvJt1KSSLxBMTqg9RHmUFyGKo+Viu41bIDjDUOimif0fS+4dvwL+7PdRtvuoV9 X-Received: by 2002:ac8:574e:0:b0:428:34d4:6b58 with SMTP id 14-20020ac8574e000000b0042834d46b58mr912184qtx.63.1704388458559; Thu, 04 Jan 2024 09:14:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388458; cv=pass; d=google.com; s=arc-20160816; b=rJHRaXq0nHlCAOc3C6xMzdExgtBTYCSTs/PTvomvn9wxp4tr/aboa1LzhF0j4Yz08q XgyhJI5vS3A36eFQL+BZEUIUbqmJHadjOHf6aiI5xmA4rg6om/ZNXN79aoHX+atvocOi //JZSX5nn+BPQLM8463pPWILJO3AoKNxBDgr7r/MBWLBi/aO0VMQyKFJVaEZtcoMtG1f Z1WoM4Y5w1gUJEZjnIBX+ETVhHBosP8aEmTCmNCSVvAfLPnDdIRUjS5pu+rDi+KMiBlK Gj++Zo+GPSIwFELVqeDHkqHzd7+TOYz9YsdG3yOr0GltnJ9aYCt5V1zoemBK0BvzP0G2 nQMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NstUmn740aiVmK2E7Q6KI+t5aKsOpGZHOE4KgGcl/0E=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=RokFj2XfJ7QIVvpXJV9EIVVeYhiUuW3xiGNycEhGI1TCeYszvyo8DNzIPCaqIP0Sww V2PPbS74AD+WFQVhJaGm+4sN9LNkEpmvx6McdfsLWDohkyjo9bahHftIt4EQwSrFZ95w JIezofOOCsfqBGjApEriIMYJOXmDd6UYhKAVIY3RokJUODI1KGMFlFB3OCXECPL01s+k X+y1nszYtKTk2fwwmSee9FZFvEufuXylnkFtj0ZvE+aKvYWC04mFpFpICBTM36ikvvjy VhwfAxJQRrW9uWf163C9YCzDyqUckHkaMpQIVTEsMVT+MjkFh8MRdGKDDpVWTqqggC9m OTBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4EC9aSto; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16995-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16995-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d17-20020a05622a05d100b00427772c3694si31553639qtb.677.2024.01.04.09.14.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:14:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16995-ouuuleilei=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=@amd.com header.s=selector1 header.b=4EC9aSto; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16995-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16995-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 4DDF61C2237B for ; Thu, 4 Jan 2024 17:14:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06D862C683; Thu, 4 Jan 2024 17:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4EC9aSto" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2063.outbound.protection.outlook.com [40.107.92.63]) (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 B5AE128DA5; Thu, 4 Jan 2024 17:12:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfF+otDr4/uElkm1WhDNXMyr8oanzR5vADyAigiI/qMLeL8KvQXJKmRUdtrcs7ENR65bj+u15pjBymlj07vhgBSZ1Oh/2DUrTzhe3ItywO3NqaHryvW2ARrrKRRk9u5PahX1xwagHBTVMFe8T0BrZeGTymvesO6OnwDudk/0uwU+Qdj2HER4OIZmv3aUK+/qTu8aDoQIJk8et2t/H91uNOsXsX3kgkVUaqwM6uqA4BkXNGYzEUHpoaoQDPU8gfPxKZV4Cd+edc8SongnxTbFEgYZUOVa3vLI9tgI6IpJyADsTPMwx7pQg56iWqXcfOVlRs28bbBZHcCqnqHPqp7REA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NstUmn740aiVmK2E7Q6KI+t5aKsOpGZHOE4KgGcl/0E=; b=d70AKCeUrkJRl/fodsPjM9wJmqH/EcEqQcRPxQS/3/6Q1Gdh2a1Ec/W1xsGH2Nut5eIOJiXKuYHCnRqv7Epne4MLkPl3GTuGfaB9mGxJHjRapJPE77nBjLHzCQ4x+bS4+ZXvPppdAu02ztHk7XnJyz1yAjN4cs0McEHCSSSI/nWAF08BnycR/JQa//2+87NaJ1gJgDgyv4hLNnwtIRrROjS/Dboz8Z8u+nXvfhiT4hCaRUawnBvDeQ7lWXv6Uerb5rumF2X55zTFVurxntYnF1rfA6Cs7huwoWYZld6AiSR2cvPT5Q3Sdo6w4lwPZRECK0R2jO5a7IcJNQI5fkSryQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NstUmn740aiVmK2E7Q6KI+t5aKsOpGZHOE4KgGcl/0E=; b=4EC9aSto/cQ+bw8ddssYWs4pSbBGsw8+1ZOaQEeZmjgBAir0RzQUSB2BgWBNGDuQGm1LwTzgIda5HvMBL5aB/+IMyvKh/8jcDAu+TQ7k+9mdjhS/F/YKAuwfxHkhWHqz518A20yd9pLNCE0Ih5q4pVi3Z3nZ4b7gFXdJy/poKIc= Received: from DS7PR03CA0221.namprd03.prod.outlook.com (2603:10b6:5:3ba::16) by MN0PR12MB6341.namprd12.prod.outlook.com (2603:10b6:208:3c2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16; Thu, 4 Jan 2024 17:12:38 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::e0) by DS7PR03CA0221.outlook.office365.com (2603:10b6:5:3ba::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 17:12:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:37 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:36 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 2/8] pds_core: Cancel AQ work on teardown Date: Thu, 4 Jan 2024 09:12:15 -0800 Message-ID: <20240104171221.31399-3-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|MN0PR12MB6341:EE_ X-MS-Office365-Filtering-Correlation-Id: 4eca0ff6-5843-4c84-ff2e-08dc0d485a1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: quINrKpWU0luNQ2TPsIWbjulM9I92FUMDj1l1F8GNNH55wQJoG67bSkF/wKHupDdcQPEPVOi1VBvtot8Yldo+8FY7AsARPWepEOULMiKkGGjsQlf0MtmauVYQ/jH6Gv5nWzfSNPvnFyVBrzbvWZkm34eKwl/b9To/MgOSJ6HTepEcLhXgvRONOHJJzbRfdv+sWEDLG+Nl/DIHiEmsgl/ZRoCUSFLv1NnEJ79UekeHTby1ytRYxLUx1FQKBRFHPBqxRXIi86J+H5hUaPhWY65uFoRhHkn6OhBK8bUTwXBnIa9XDss5g/ybVjOv0z5D5Xgvu3D0oz6GFwNkcCPcxCMDaMGAMN5yWQ4AM3uGIrERvsB88HJk9MCiBg3+28kiO1y8d1APhNheQZPa7e3C8z2UurY97GJIkoOrnlflNKRv39mYA+TMrUioCtvqXReVMC8wjq2VWFHmhD3ZjBho/wGlhzPv/TVwEmLNqY1uoIOMmxrdAx8GjJfkJqvMjOd+Yyh5N7pgjZZCNoRCYNtpISS6RMII1tQKzcWzQIKJnpEnGcP9zRTC/oyLN8U4Q8lMutRI75cY2byQCdaiPOfcdGepirRoEP2ZR2VOaIwWYiczjGcCtHWC1pRjXZOkZUQlSqP5rUM5qJFWoiuB4W0r3MLO7kWWRgmsMta18FUiXlgFdKhotYqmiFSLC4hENfun6v2XAA3HLfGQ3cIbzI9viecYPy8nJsma2ZogV9NZnFo9iw+F781gBR5pEn6l64DabqOeTXbmGLKbJbQPc9fY6ogQA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(396003)(346002)(376002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(82310400011)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(478600001)(426003)(336012)(26005)(6666004)(1076003)(82740400003)(81166007)(36860700001)(86362001)(36756003)(356005)(2906002)(5660300002)(41300700001)(47076005)(2616005)(83380400001)(16526019)(110136005)(70206006)(8676002)(54906003)(316002)(70586007)(44832011)(4326008)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:37.8417 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4eca0ff6-5843-4c84-ff2e-08dc0d485a1a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6341 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180832336974301 X-GMAIL-MSGID: 1787180832336974301 There is a small window where pdsc_work_thread() calls pdsc_process_adminq() and pdsc_process_adminq() passes the PDSC_S_STOPPING_DRIVER check and starts to process adminq/notifyq work and then the driver starts a fw_down cycle. This could cause some undefined behavior if the notifyqcq/adminqcq are free'd while pdsc_process_adminq() is running. Use cancel_work_sync() on the adminqcq's work struct to make sure any pending work items are cancelled and any in progress work items are completed. Also, make sure to not call cancel_work_sync() if the work item has not be initialized. Without this, traces will happen in cases where a reset fails and teardown is called again or if reset fails and the driver is removed. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 0d2091e9eb28..b582729331eb 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -464,6 +464,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) if (!pdsc->pdev->is_virtfn) pdsc_devcmd_reset(pdsc); + if (pdsc->adminqcq.work.func) + cancel_work_sync(&pdsc->adminqcq.work); pdsc_qcq_free(pdsc, &pdsc->notifyqcq); pdsc_qcq_free(pdsc, &pdsc->adminqcq); From patchwork Thu Jan 4 17:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5746804dyb; Thu, 4 Jan 2024 09:16:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+x+GjDL07BcJ13RMyHiFCjdny7u0vAgStWHsbG4sTJjmxxk7CX2lQOXzmbplRKTsyg2NT X-Received: by 2002:a17:903:32cd:b0:1d4:3b5b:7aae with SMTP id i13-20020a17090332cd00b001d43b5b7aaemr1051145plr.104.1704388587024; Thu, 04 Jan 2024 09:16:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388587; cv=pass; d=google.com; s=arc-20160816; b=rBquVcDcJkVkIYZaBPuA+Kyc54qrz7/O9CfqeIg5pApo6hMMA1CgW4IoupAjbUThVQ TqbrrPuWeQOjKl2/hdHvnvdOMeP06aM49WL707Jqu/Xe/LuiAOUWvS4qG918HiFk9Cis BqEUniBDfUZemKo9pAJ09f1lg5GArCxQhz89ur4fIk1eSN5lsAYngDl9jyNEQonSnUUV Cc8VdcL3spKLMzigqJnLwbOhjqya+2WvXZu1GA44cOdtV1S7c8f3d7KGWLAqwhc29ouG zzIQJmLxE37xZQWaO6hEMlM75vVvlBV7be4oU3c9HWu6blKn3t/TLpTAMbAjcyu4qtBP mUkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vBhNvqaRMdtFzSqi5mm/2MbuFLYYK6P5oiVtXFHeKKI=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=ZzKtuxQ9hScuHEqaK7yXYJIpDQLw/RxJDUusVslBJdaDWvvf7To6XS1K2KCr+yLYfq fUcnzQU9vZd3MNx7BN9WhcfJLtkwXR8VUrb3uGfWjGackwCYePv6xUtOze9PwGpS7r9c w586DcLQyan7r6jXVWQFp7OiBKkwzh5wCYDBt4MTdtvzrzQFNRLXMgP4wsMvFTcBDWXG 3e9YxU8XAfIOSMxVwD9pbmnpvnIbGm1eTfMz7umdkspvuLmtxe6wLS95lgtb3qItVASH Asp5cO0ZVhibiOodWjHn+SQ3DbDU+Jyz2WXC9xkEYUGIsBdqqRRAyUlOvDZefywn2enz lzdQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=LG5xPR1P; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-17001-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17001-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 5-20020a630905000000b005cdfa58ffe8si21235046pgj.240.2024.01.04.09.16.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:16:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17001-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=LG5xPR1P; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-17001-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17001-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 698C6288407 for ; Thu, 4 Jan 2024 17:16:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C08402D7B0; Thu, 4 Jan 2024 17:12:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LG5xPR1P" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) (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 657282C851; Thu, 4 Jan 2024 17:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NFYCAi8Q5t1l/fZwEhy1MGipf9Ua7Wm7XOMWnnvE0v1KjW50h7GfasOO7f/ZhwiyD2SXaqvqYx/u11JUVPyGwf8cupBWxuAb8/DdtBVHbhRgB9eQGUzOnV7ig3pJUcp9g7PIXvi+Z+MtGx0Qo0aOeGFKhuMt/6G8FaM6FbqmVvJMjA5kszd4zi3m3Io9rzXU2cA6RRiGMiUbuW/inMB/kQXRhexX0LiIZPG+XgPbgDoSdw++Gifb03iIxhQuj0Y2b0PdHW5QXlG9ee8QikX8ii8yhXHetXJliiCJBL6EHO8VgsRxdAtFnzsvzIDxuq/qYQquV1nsQXcYP0DBW9dHSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vBhNvqaRMdtFzSqi5mm/2MbuFLYYK6P5oiVtXFHeKKI=; b=BZH2wq6wg4oSl6/LbNxZphtiz8ctBPfXJgbtpHgezkmJ/IXytkffsyUgr6kAf3X5DuUTTJoInCXx5H+1XjNLiXMmzRlVu3OjsXrALEA7rAEIQWhxKGMG4PCoaxBUXQKQyUZRk0HLVKEdeCJ4anEF+SIQvEOeyHDjFLcQNcL67QLC/enWNDtnVHmuxOmQ0sMZrxZXhmF1JDqiwKeLdM1Jfex21XJwR9Xl7E9l50dOR5laLZN8yjoXQsWi2n1tfnXe5gRS/M1p6ZEx5eKW5bSSYnUkl9jlOt7e28vOuwIFAwQ6V8bUYyfR61iFKtXpIgnAkyIEG9j1hGBmNcu2/nXcXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vBhNvqaRMdtFzSqi5mm/2MbuFLYYK6P5oiVtXFHeKKI=; b=LG5xPR1PwggKIVnHTezif/Jc9vXARR63jNiAbvn0WCOMzIsMXy3qncyBiwy5BHyGe/zfh5+ZtRoCYa4jbIJh4JqkOqeimtXqIFtGfquu8TC1rdWQ9OZrqhp5J8pXC5gIyV+7tQPrum8+2nJ1kqo64OTyqlvqKctt+/N0jCMNvCs= Received: from DS7PR03CA0236.namprd03.prod.outlook.com (2603:10b6:5:3ba::31) by PH0PR12MB5629.namprd12.prod.outlook.com (2603:10b6:510:141::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 17:12:42 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::e6) by DS7PR03CA0236.outlook.office365.com (2603:10b6:5:3ba::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16 via Frontend Transport; Thu, 4 Jan 2024 17:12:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:41 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:37 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 3/8] pds_core: Use struct pdsc for the pdsc_adminq_isr private data Date: Thu, 4 Jan 2024 09:12:16 -0800 Message-ID: <20240104171221.31399-4-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|PH0PR12MB5629:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ef2253b-a7c1-4d81-32e4-08dc0d485c76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0UmF/kWaqEwjrduKNfab4GwOxflMIzRsAamJgiIxh/2BaWTWx3RO5tN4ol/7mwZ3D/yMRDzRvQW4OVHYg+A2IEFx9LyQSjlzU54IF1T+tcGuIccpvK6jcaWZG6/ckGgujMPtqwXyLNmNr9PUCy1qWCJCq/fAU06Pe3aR70mfyjFj1Vi+svCfmOiNznyIlSPU40wiQnXClWGzuow4Nt6Hi5ZCkt+uz/3suY7rj4E3Zv6aPInEJRJFpY79fiEFJJyAT5nPK5BsrKcKpEMxIUE98U3F3oH2U4d7yQlA8A4vG5GC6IRfwB6Xr+co1TzZXjTq+YukIT1BO8D+BWs44oJCrvHu6ONoJJ0jeIyJZMx+r1ScuRm5Z1ExAFNPs5gz5dq44pjjNr7P15NkNBvVWKuZkKye/f5tXDH8wDmWGscB0B1NQSX/UMln67jcXmT05FpsnqPubZTbHcaRQYW6CDx+S+94a4bnc6g2IFGeE3R8BOoxRUREI8J0AqZvUXSxeZYlWUOCqYN7T58XM3Xg7icAcumPPVWaS3GuUDlchHtPOjIc7+pSdbABIAEL7Um8O70cRAzol6TxA/DDo+9sz/8Jyf1CuOEKEodk0AlQdOp+3+0K4paQqh+zTsK93s63jxX7wCHhOWF6Ept2kT6dbHSvsPlu/FokaPSr+G6OrMmWDscRB7Jyv+SLE4NRmHFs+geBrl5nWK5MjYVzyQBDBQ6+C0b39JZY7p8aX7/omB/Fmrt7qlNFMdo3tCqvJke726mVPp5wom2i988dtCHV/2J6Dg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(82310400011)(186009)(1800799012)(64100799003)(451199024)(36840700001)(46966006)(40470700004)(40460700003)(40480700001)(2616005)(336012)(1076003)(426003)(6666004)(478600001)(26005)(86362001)(36860700001)(36756003)(82740400003)(356005)(81166007)(2906002)(16526019)(41300700001)(47076005)(83380400001)(70586007)(5660300002)(44832011)(8676002)(110136005)(316002)(54906003)(70206006)(4326008)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:41.8574 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ef2253b-a7c1-4d81-32e4-08dc0d485c76 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5629 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180967256548690 X-GMAIL-MSGID: 1787180967256548690 The initial design for the adminq interrupt was done based on client drivers having their own adminq and adminq interrupt. So, each client driver's adminq isr would use their specific adminqcq for the private data struct. For the time being the design has changed to only use a single adminq for all clients. So, instead use the struct pdsc for the private data to simplify things a bit. This also has the benefit of not dereferencing the adminqcq to access the pdsc struct when the PDSC_S_STOPPING_DRIVER bit is set and the adminqcq has actually been cleared/freed. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/adminq.c | 5 +++-- drivers/net/ethernet/amd/pds_core/core.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/adminq.c b/drivers/net/ethernet/amd/pds_core/adminq.c index 5beadabc2136..68be5ea251fc 100644 --- a/drivers/net/ethernet/amd/pds_core/adminq.c +++ b/drivers/net/ethernet/amd/pds_core/adminq.c @@ -135,8 +135,8 @@ void pdsc_work_thread(struct work_struct *work) irqreturn_t pdsc_adminq_isr(int irq, void *data) { - struct pdsc_qcq *qcq = data; - struct pdsc *pdsc = qcq->pdsc; + struct pdsc *pdsc = data; + struct pdsc_qcq *qcq; /* Don't process AdminQ when shutting down */ if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) { @@ -145,6 +145,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) return IRQ_HANDLED; } + qcq = &pdsc->adminqcq; queue_work(pdsc->wq, &qcq->work); pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR); diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index b582729331eb..0356e56a6e99 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -125,7 +125,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq) snprintf(name, sizeof(name), "%s-%d-%s", PDS_CORE_DRV_NAME, pdsc->pdev->bus->number, qcq->q.name); - index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, qcq); + index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, pdsc); if (index < 0) return index; qcq->intx = index; From patchwork Thu Jan 4 17:12:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5745928dyb; Thu, 4 Jan 2024 09:15:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz/qE5OZeOqCMDK1Dus5Of9GDaTF8xySlhI6x4QILBPjLC8Z+iZklM74CJE07W/O9cbkv5 X-Received: by 2002:a05:6a20:4c11:b0:199:2327:28a9 with SMTP id fm17-20020a056a204c1100b00199232728a9mr474843pzb.109.1704388511605; Thu, 04 Jan 2024 09:15:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388511; cv=pass; d=google.com; s=arc-20160816; b=XRsOh5w9JrQDlbDh+6qyAfnP5uuoBdlFOigbHbkFnmFGtnIdNivncww9m2JXKGLJ7I r+rC4MsG7p3e4c3bTAIdSv8ZnJyDSavVGwEuGembiOTySlwe+u1b89VZF50Dz02SOJtk LG9Xo+FQc71i83rxpfAguggt/QHNBGDQJLgg3nSxWUpcm9+4hyVA1uaw7FuXVAYI2Vbv 2yyglKBIDqmFk0ci7m1TmsyEyK1aMvyYpsu8h3m82UDZ2HyPSyr2tPfiDuuVv6bPQVM+ kM9lUcdtG9JpgY3ue+jMVpFmTAbkBBp5GpuIlVIQ7I3z+YnAaTi2RBPj9/z3pKm1qAXa +f/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a0cwSIWaX4xESWMXtNloBt2dXBKHki5Ge3vDIzXrBb4=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=iwW2RQ92NUTIySHDt7wwcXVz7imW1QQYc+cQurSlLGb99kF7GUYABexNuL2r63ijDq Q5kds89a6xykuqFUWX9d/tN79eTBvWl38Xa5ImEFqj67gwHLFz8xxvC4mIgLwQUdpC7G 5iRwj4GJ6NFrUHZDcH6f6pkLwIIrPBo2I9ebRJGTOXJDmy6XAFgoUDTW/+leA62Jc/9w 4chQ97QIzQexLvdeOrZHtUYiren5TmmGCLxamkiEkEeJQmQjWKs5/zRORbOjpgtbXc1B UlqRfA7CRetjZlvdXeETTcvftejJmm8QXZIsYRoRbfquE1f5215vtjEEMlL5eKJsvKMu kYgw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=rOMK1gaQ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16996-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l135-20020a633e8d000000b005cdf9c8000asi21866013pga.147.2024.01.04.09.15.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:15:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=rOMK1gaQ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16996-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2AFA52865CE for ; Thu, 4 Jan 2024 17:14:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B46C2C85A; Thu, 4 Jan 2024 17:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rOMK1gaQ" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) (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 3B7F02C68D; Thu, 4 Jan 2024 17:12:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mp8gM+mo5FfYWouLrsaw08N2CGA4qfTNbBlRp5bTlrDqOkA553S1mjrELGLrfKNxmJyyCNT90sdDPAsIYh/E8enphgjth4OKdnPfatCzch1VYLsmtgwfENyew3ZOIXY0s8YN7seCCYvZYU+FoWsJu7tobJYCiuVx0Ta8YUL+iMj95dhrZjbGECgq/tykG0voAMrgPFcd+62kVHeYtDWNPjeDAtOVO/73wjeTRk3MPHXoNLmPSV1BGUTAPV0CKpAduEYUiCn7NNbUXxuu7BzKpnalw6bDRX2a/LKb6mTaBOZ/5K6qFEL+jz3BzA2uU4/+0dlfO33mrDjObg/FrVPZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a0cwSIWaX4xESWMXtNloBt2dXBKHki5Ge3vDIzXrBb4=; b=Uv+dpgvuJpeTx4X/pUe/kXT/+3iXKlRslWBtT2AthuSjDYXIsUjU9j6qFShHHNuxZGKfZn2A2+lMGrLZZCOBnPtu3UwMzAmwtMTa3jTNm7wcdvcW/ZsGT/XdXsF3Y8lboPLbVUo8EOR3ur4l3Rv1ySrBw86Y+DBIr3Fm3yaBvzAWwUSAP8nROckOMp24J2I1csJNO7+z5a3RxtJBDeh5YGVrLy29Lb3nhRl/h9Yo3Fop9fjZl1VoZlmXTUWQeWIhW7Ge67slPeh26RTCiCSDsobwutcEEjv8h+1vPCvJ1QS3bY4ZUIKs6LXkvnuOYyNF9O6fCA1swqLYjD7RY6TF+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a0cwSIWaX4xESWMXtNloBt2dXBKHki5Ge3vDIzXrBb4=; b=rOMK1gaQr7ELFMj0TxgsuIMrl9HeNvMAa+jHqGdn6fmcDo2DqzY8X7I/DfhCTQ9Kdt2Fb/6my6QctoU5mDsCN0oW57ZteYvYiY5255Nt/rSN9Q7hrhkO51c6fqA/uot9Kap3gR+ZPO5WpZ4PAfiCoNaoKfb0hoGAsj2X3QQhVes= Received: from DS7PR03CA0229.namprd03.prod.outlook.com (2603:10b6:5:3ba::24) by SN7PR12MB8436.namprd12.prod.outlook.com (2603:10b6:806:2e3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 17:12:42 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::20) by DS7PR03CA0229.outlook.office365.com (2603:10b6:5:3ba::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 17:12:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:42 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:38 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 4/8] pds_core: Prevent race issues involving the adminq Date: Thu, 4 Jan 2024 09:12:17 -0800 Message-ID: <20240104171221.31399-5-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|SN7PR12MB8436:EE_ X-MS-Office365-Filtering-Correlation-Id: db67b6a0-1f26-46d4-55f9-08dc0d485cda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2Z3fLDNeJdZKf/MWMwhpdThjlzrBAQ7MDYpAOt4YwtBRv0pGd6DWYdY3g/jXLELOpNwVp4jNR6vKptWfM1u7OdzLNuwTxpLUv5cCjB8o/3mpgyhi0lx6yY7rcvRdOYZwZG8amIrcrjaBpuIiVZPk1+lMkFLq2XIIcsXlU2Tvfbi0tLgadCNtgcSu2tVH3HwtulctbjJWTrxiOgTRxWdaeeoG0dP9YiYoHJS3wPW77k3cid5p0Mbhn7+L5cbK+I/dEmoBXuE2IyMO5DaMK2eKejEraaKiFZGtd9ko6xBc0A023pxY13MGoXnrGRpE4xFX/kxabgMfpoK0rLvERuK/FmRoUBJk7qGGJHBwnAvfGNx4nfATj5ltNAMCKMFbs8jOxzhQEDH2gmfzpV/5fPZd8Bx1ruD2CGf+g29nqFWRhKk94IhCqJs1q0YUO4IWp9eBuMopdfQas5ekFxExNmBpOrK1sxVm+fop/1jcuhRGLQMx7kNOoZJPfpMN+5CizxqmLsCFrUbFbfnzC678nTOTyZAgZ9M0JBQzdjiUyKviZ5DEXjimBtW5yu/AnBV8s9tsg01jPxczxXs0kFPZ/vPdxTrxVQ6f7y/pXrKItCMR6sl+zieTG57T1QDwjlq2VjcyPt1y8cBStVwdHi0m3ySXccvLmdW0Rgba/pqIXjcFOiPZb+/x+Yvgnf7NLGQSn2TsRfzBNxOC/uiLgJU/iWJHX2+Hkd/pBQhtiXnmziALfdAflMCmzROdV0isaNJClpqDZ4GRA1WwpV3mtKCq+4RiTQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(39860400002)(136003)(396003)(376002)(230922051799003)(451199024)(186009)(1800799012)(82310400011)(64100799003)(36840700001)(46966006)(40470700004)(2906002)(4326008)(36860700001)(8936002)(8676002)(47076005)(44832011)(5660300002)(36756003)(82740400003)(356005)(41300700001)(81166007)(6666004)(478600001)(1076003)(26005)(336012)(426003)(2616005)(316002)(54906003)(16526019)(83380400001)(110136005)(70586007)(70206006)(40480700001)(40460700003)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:42.4980 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db67b6a0-1f26-46d4-55f9-08dc0d485cda X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8436 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180887827224724 X-GMAIL-MSGID: 1787180887827224724 There are multiple paths that can result in using the pdsc's adminq. [1] pdsc_adminq_isr and the resulting work from queue_work(), i.e. pdsc_work_thread()->pdsc_process_adminq() [2] pdsc_adminq_post() When the device goes through reset via PCIe reset and/or a fw_down/fw_up cycle due to bad PCIe state or bad device state the adminq is destroyed and recreated. A NULL pointer dereference can happen if [1] or [2] happens after the adminq is already destroyed. In order to fix this, add some further state checks and implement reference counting for adminq uses. Reference counting was used because multiple threads can attempt to access the adminq at the same time via [1] or [2]. Additionally, multiple clients (i.e. pds-vfio-pci) can be using [2] at the same time. The adminq_refcnt is initialized to 1 when the adminq has been allocated and is ready to use. Users/clients of the adminq (i.e. [1] and [2]) will increment the refcnt when they are using the adminq. When the driver goes into a fw_down cycle it will set the PDSC_S_FW_DEAD bit and then wait for the adminq_refcnt to hit 1. Setting the PDSC_S_FW_DEAD before waiting will prevent any further adminq_refcnt increments. Waiting for the adminq_refcnt to hit 1 allows for any current users of the adminq to finish before the driver frees the adminq. Once the adminq_refcnt hits 1 the driver clears the refcnt to signify that the adminq is deleted and cannot be used. On the fw_up cycle the driver will once again initialize the adminq_refcnt to 1 allowing the adminq to be used again. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/adminq.c | 31 +++++++++++++++++----- drivers/net/ethernet/amd/pds_core/core.c | 21 +++++++++++++++ drivers/net/ethernet/amd/pds_core/core.h | 1 + 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/adminq.c b/drivers/net/ethernet/amd/pds_core/adminq.c index 68be5ea251fc..5edff33d56f3 100644 --- a/drivers/net/ethernet/amd/pds_core/adminq.c +++ b/drivers/net/ethernet/amd/pds_core/adminq.c @@ -63,6 +63,15 @@ static int pdsc_process_notifyq(struct pdsc_qcq *qcq) return nq_work; } +static bool pdsc_adminq_inc_if_up(struct pdsc *pdsc) +{ + if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER) || + pdsc->state & BIT_ULL(PDSC_S_FW_DEAD)) + return false; + + return refcount_inc_not_zero(&pdsc->adminq_refcnt); +} + void pdsc_process_adminq(struct pdsc_qcq *qcq) { union pds_core_adminq_comp *comp; @@ -75,9 +84,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) int aq_work = 0; int credits; - /* Don't process AdminQ when shutting down */ - if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) { - dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n", + /* Don't process AdminQ when it's not up */ + if (!pdsc_adminq_inc_if_up(pdsc)) { + dev_err(pdsc->dev, "%s: called while adminq is unavailable\n", __func__); return; } @@ -124,6 +133,7 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx], credits, PDS_CORE_INTR_CRED_REARM); + refcount_dec(&pdsc->adminq_refcnt); } void pdsc_work_thread(struct work_struct *work) @@ -138,9 +148,9 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) struct pdsc *pdsc = data; struct pdsc_qcq *qcq; - /* Don't process AdminQ when shutting down */ - if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) { - dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n", + /* Don't process AdminQ when it's not up */ + if (!pdsc_adminq_inc_if_up(pdsc)) { + dev_err(pdsc->dev, "%s: called while adminq is unavailable\n", __func__); return IRQ_HANDLED; } @@ -148,6 +158,7 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) qcq = &pdsc->adminqcq; queue_work(pdsc->wq, &qcq->work); pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR); + refcount_dec(&pdsc->adminq_refcnt); return IRQ_HANDLED; } @@ -231,6 +242,12 @@ int pdsc_adminq_post(struct pdsc *pdsc, int err = 0; int index; + if (!pdsc_adminq_inc_if_up(pdsc)) { + dev_dbg(pdsc->dev, "%s: preventing adminq cmd %u\n", + __func__, cmd->opcode); + return -ENXIO; + } + wc.qcq = &pdsc->adminqcq; index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp, &wc); if (index < 0) { @@ -286,6 +303,8 @@ int pdsc_adminq_post(struct pdsc *pdsc, queue_work(pdsc->wq, &pdsc->health_work); } + refcount_dec(&pdsc->adminq_refcnt); + return err; } EXPORT_SYMBOL_GPL(pdsc_adminq_post); diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 0356e56a6e99..3b3e1541dd1c 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -450,6 +450,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init) pdsc_debugfs_add_viftype(pdsc); } + refcount_set(&pdsc->adminq_refcnt, 1); clear_bit(PDSC_S_FW_DEAD, &pdsc->state); return 0; @@ -514,6 +515,24 @@ void pdsc_stop(struct pdsc *pdsc) PDS_CORE_INTR_MASK_SET); } +void pdsc_adminq_wait_and_dec_once_unused(struct pdsc *pdsc) +{ + /* The driver initializes the adminq_refcnt to 1 when the adminq is + * allocated and ready for use. Other users/requesters will increment + * the refcnt while in use. If the refcnt is down to 1 then the adminq + * is not in use and the refcnt can be cleared and adminq freed. Before + * calling this function the driver will set PDSC_S_FW_DEAD, which + * prevent subsequent attempts to use the adminq and increment the + * refcnt to fail. This guarantees that this function will eventually + * exit. + */ + while (!refcount_dec_if_one(&pdsc->adminq_refcnt)) { + dev_dbg_ratelimited(pdsc->dev, "%s: adminq in use\n", + __func__); + cpu_relax(); + } +} + void pdsc_fw_down(struct pdsc *pdsc) { union pds_core_notifyq_comp reset_event = { @@ -529,6 +548,8 @@ void pdsc_fw_down(struct pdsc *pdsc) if (pdsc->pdev->is_virtfn) return; + pdsc_adminq_wait_and_dec_once_unused(pdsc); + /* Notify clients of fw_down */ if (pdsc->fw_reporter) devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc); diff --git a/drivers/net/ethernet/amd/pds_core/core.h b/drivers/net/ethernet/amd/pds_core/core.h index e35d3e7006bf..cbd5716f46e6 100644 --- a/drivers/net/ethernet/amd/pds_core/core.h +++ b/drivers/net/ethernet/amd/pds_core/core.h @@ -184,6 +184,7 @@ struct pdsc { struct mutex devcmd_lock; /* lock for dev_cmd operations */ struct mutex config_lock; /* lock for configuration operations */ spinlock_t adminq_lock; /* lock for adminq operations */ + refcount_t adminq_refcnt; struct pds_core_dev_info_regs __iomem *info_regs; struct pds_core_dev_cmd_regs __iomem *cmd_regs; struct pds_core_intr __iomem *intr_ctrl; From patchwork Thu Jan 4 17:12:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5746526dyb; Thu, 4 Jan 2024 09:16:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgeqHJDCpKn/7RgUOR3DTjkbexGgRMss3xXve9p3fPI7Z7gP3fF2RCOkvQn+W7q0EOZnUY X-Received: by 2002:a17:90a:6543:b0:28c:3788:3722 with SMTP id f3-20020a17090a654300b0028c37883722mr824949pjs.18.1704388562240; Thu, 04 Jan 2024 09:16:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388562; cv=pass; d=google.com; s=arc-20160816; b=ck9InD9cp+nLCebX5+mkmMUwLdUaqNvbRKtH0fKHyzJNnOZV3+Xulzu5Or/HGFrRF4 RXbnSqK8TtfWzvAZ5ERhYtGgX8fM8+oYicdaynBr3aDLQkngAxAf+XuN9g95XqGu64Pg Yzw5cJ47xtS/XucDa+SJ5peAJjQ9EEme/dPUNQttIqVKxA8NQRmQefbr0QjOTUH6d4DJ dXDurRdK0oC/BVCFWpA/6qQERZrSR9AFBdMTCe4gkxR78puvqmPzE0p0PnWBkPR87dF0 k8Q3qF2h1mG5tcjq7JoSGQ1bC1pS6NgMtKsNDUZMHu78tPAT60zT5moRU3WTBWH87Fcd KsbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jhVBXH+IltD3kpoJwfm00H6Rnk41GD9XT2RASqKLOYg=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=neUe0EdRU8Wu4vwyiOkHxSkstPym05/pXsR0owY5OtrrFjGqMP+2OhYHJkAjzCJC+T hHX9aRRE6mHUM/Yaeg2JpduZvwizybTG52BBh7JTkU+Nc06ebNF/QDoYZYOBOrmTpIE/ vVK4HpP0UeUsOqwy3Od68na6em+sh5hjEAIBFxwQy/kUpAWa1BOAfMd0Jiol6IWRj+Aq 8E3x1iBafUErGBY+upGRbWNZLPec8h8awHrc01dqgr5HRohl8BYvUkPoQJcS+N9zlefH hktDwh27gD/Vxg/6pjudVv7j3wMM8s1Mrptlvvy2rqX2Vd8QjspWngCRz3w6U+Ub8HcI nvcQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZVtuwFWT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16998-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id w10-20020a1709029a8a00b001d4e04b66f4si833026plp.594.2024.01.04.09.16.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:16:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZVtuwFWT; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16998-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D718B24717 for ; Thu, 4 Jan 2024 17:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 965BF2D605; Thu, 4 Jan 2024 17:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZVtuwFWT" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2084.outbound.protection.outlook.com [40.107.93.84]) (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 442E828DB9; Thu, 4 Jan 2024 17:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NgHAUJZQQJGOZ9gATJByf3+7y0lwKBtotpqvC8fxuQxHCUs5YvRc9FMogSlvGBPR/LUXmO3INHxH6v5ENqE/TNIhJdDxq03hXWCeRQzzv/9KU9Ic4/dgI3H79VKgoBjtA6w2RMOC8aeCxPbV2v95I9U9XwbvILhOoh+N8GIa/i+rxuxjfu5ib2akC/XOI0oNNXCci0/ScPjHn+Ecd3sZm/H7lGPd9YjNY/pvBdb9Rfhxi6gsY6/ivjuDrDhGH9B/1RJBwGR9g2C4Tg4rRr3G0C8t9JMl1qKL3SHeWuCfKGNlMOzYu0DIaRqhADnc2S/x1qKUDrSEXpxuVPWtXjk+ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jhVBXH+IltD3kpoJwfm00H6Rnk41GD9XT2RASqKLOYg=; b=aEa/GTDVshEIE36kJPDPuVsgfcTphSjBCEqVAHYd+v11bZJuY4FNVftOiSGOaOgbpADnNO3uqKzlHbuiN6WiH0n5ANOdUgMTjY+IIx+kBECwLiuWXt5zIbAF2zs7hI+nUb/bGeO174+ykq269rPKhN6Gp7ABD46evs9HhkQFWbr7RSCaGu1jK9afKI/Acal2HS3UnzvvyJ8gDRm0i7mSeKsgB0g5Av3DlZEYVhxE1G2SLKE6FvpKXDIIvIWhIPCFaWHqpb8ab1fBJlofv1sUdkXZNmj41RJxADtYAYBnI7rL/i6bcw0aRF1T93T6idvOhprMEBV12PnRQh+FbKp4qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jhVBXH+IltD3kpoJwfm00H6Rnk41GD9XT2RASqKLOYg=; b=ZVtuwFWT/mDYLx9nEV3fEUqycDHT3+Dppr/WRZwkzEX1oDx69OSiga7CiG+kja3JNBi2ZdU7mwDDwmnSV75R8BD+2g1GfJ7gWZuIddETxjk6Fwl33zAX1pm2qlCvWFsvJy8bsneamaT2i44lvcmuqizWPYYc7xetD5FA50aokxw= Received: from DS7PR03CA0220.namprd03.prod.outlook.com (2603:10b6:5:3ba::15) by SA1PR12MB8142.namprd12.prod.outlook.com (2603:10b6:806:334::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 17:12:43 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::b9) by DS7PR03CA0220.outlook.office365.com (2603:10b6:5:3ba::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 17:12:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:42 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:39 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 5/8] pds_core: Clear BARs on reset Date: Thu, 4 Jan 2024 09:12:18 -0800 Message-ID: <20240104171221.31399-6-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|SA1PR12MB8142:EE_ X-MS-Office365-Filtering-Correlation-Id: cf419c8f-dd04-4246-0398-08dc0d485d29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xJ3Syczm38eTP9R2kqZ222Q91A3Zz4BQIU6nz/o+Yei2fvfAlRer4YZjIcbwC6H0pVk3fM3F3eZFJao9AZ5w9qJprkoiaVQfW0uRwaSMlELcDniBXdwRisbKO/2E77zRmKTD61DIkM/1mr1tA1g5byJLXpaTmKF6IYhVvRv447fg7gIsXuEWAsAiG3A+gt3V4x/qw1c00t1zbOGOojADyF0sZosRXP0rXKtUDzlhEne1C18qIGib8Nwfrs7Czk3BbZQhau1uhcQ4W7+S0cxmawSRkspL/kGbE/Tt/ENFs0Gx14/ShiKN820zuwIjWaqLqcV2we/FXliAedpkZI1XEJNV0+3s7ljO2WEZl56wj9cH1wj+i7sQqQ2ch/97/1RBSxWhrT0h0jruobcYUeyiC8XdKAAplqkPBW86pRxN+FIw1fNcAUKMxnF0NLdgwLVaArwzKLiZTjVzi8dAWiim5fxFaDiD/F4/aJiRPIavctvjWAhpJ1AgykhoOJdpXuAEg+aVhyfC3t6fwJn1+vhoTTY3aQjFN+Y2Ynmpm/NzqGYFe+ir3gqIg8Ng+Nn2W+zLIyxoY0CSbtI3OvipEBpkwBKZXUr8+hr8+/ybzPn7TILEyE+5c7Bavi21UCp4bpKzl5AO7GfVLLA4YZ6R03EMvsrOrU2BGN65CyDT3GFPdLKcpJAHVpJRgbkwv47F1iiuOveGJFFVrTp+zK/bQx4/01hW64cYhNzg/VB2AFcjCMTjYUetNETuEY/pVbvEsF3qkqM9fqpItlIrcTHR8dNYbg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(39860400002)(376002)(136003)(230922051799003)(186009)(64100799003)(82310400011)(451199024)(1800799012)(40470700004)(46966006)(36840700001)(426003)(26005)(2616005)(1076003)(336012)(6666004)(478600001)(47076005)(16526019)(83380400001)(41300700001)(2906002)(4326008)(316002)(8936002)(54906003)(70206006)(110136005)(70586007)(44832011)(8676002)(36860700001)(5660300002)(82740400003)(86362001)(36756003)(81166007)(356005)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:42.9980 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf419c8f-dd04-4246-0398-08dc0d485d29 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8142 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180940709251983 X-GMAIL-MSGID: 1787180940709251983 During reset the BARs might be accessed when they are unmapped. This can cause unexpected issues, so fix it by clearing the cached BAR values so they are not accessed until they are re-mapped. Also, make sure any places that can access the BARs when they are NULL are prevented. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/adminq.c | 28 +++++++++++++++------ drivers/net/ethernet/amd/pds_core/core.c | 8 +++++- drivers/net/ethernet/amd/pds_core/dev.c | 9 ++++++- drivers/net/ethernet/amd/pds_core/devlink.c | 3 ++- drivers/net/ethernet/amd/pds_core/fw.c | 3 +++ drivers/net/ethernet/amd/pds_core/main.c | 5 ++++ 6 files changed, 45 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/adminq.c b/drivers/net/ethernet/amd/pds_core/adminq.c index 5edff33d56f3..ea773cfa0af6 100644 --- a/drivers/net/ethernet/amd/pds_core/adminq.c +++ b/drivers/net/ethernet/amd/pds_core/adminq.c @@ -191,10 +191,16 @@ static int __pdsc_adminq_post(struct pdsc *pdsc, /* Check that the FW is running */ if (!pdsc_is_fw_running(pdsc)) { - u8 fw_status = ioread8(&pdsc->info_regs->fw_status); - - dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n", - __func__, fw_status); + if (pdsc->info_regs) { + u8 fw_status = + ioread8(&pdsc->info_regs->fw_status); + + dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n", + __func__, fw_status); + } else { + dev_info(pdsc->dev, "%s: post failed - BARs not setup\n", + __func__); + } ret = -ENXIO; goto err_out_unlock; @@ -266,10 +272,16 @@ int pdsc_adminq_post(struct pdsc *pdsc, break; if (!pdsc_is_fw_running(pdsc)) { - u8 fw_status = ioread8(&pdsc->info_regs->fw_status); - - dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n", - __func__, fw_status); + if (pdsc->info_regs) { + u8 fw_status = + ioread8(&pdsc->info_regs->fw_status); + + dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n", + __func__, fw_status); + } else { + dev_dbg(pdsc->dev, "%s: post wait failed - BARs not setup\n", + __func__); + } err = -ENXIO; break; } diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 3b3e1541dd1c..023a59c8e425 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -600,7 +600,13 @@ void pdsc_fw_up(struct pdsc *pdsc) static void pdsc_check_pci_health(struct pdsc *pdsc) { - u8 fw_status = ioread8(&pdsc->info_regs->fw_status); + u8 fw_status; + + /* some sort of teardown already in progress */ + if (!pdsc->info_regs) + return; + + fw_status = ioread8(&pdsc->info_regs->fw_status); /* is PCI broken? */ if (fw_status != PDS_RC_BAD_PCI) diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c index 31940b857e0e..62a38e0a8454 100644 --- a/drivers/net/ethernet/amd/pds_core/dev.c +++ b/drivers/net/ethernet/amd/pds_core/dev.c @@ -57,6 +57,9 @@ int pdsc_err_to_errno(enum pds_core_status_code code) bool pdsc_is_fw_running(struct pdsc *pdsc) { + if (!pdsc->info_regs) + return false; + pdsc->fw_status = ioread8(&pdsc->info_regs->fw_status); pdsc->last_fw_time = jiffies; pdsc->last_hb = ioread32(&pdsc->info_regs->fw_heartbeat); @@ -182,13 +185,17 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, { int err; + if (!pdsc->cmd_regs) + return -ENXIO; + memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd)); pdsc_devcmd_dbell(pdsc); err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds); - memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp)); if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq) queue_work(pdsc->wq, &pdsc->health_work); + else + memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp)); return err; } diff --git a/drivers/net/ethernet/amd/pds_core/devlink.c b/drivers/net/ethernet/amd/pds_core/devlink.c index e9948ea5bbcd..54864f27c87a 100644 --- a/drivers/net/ethernet/amd/pds_core/devlink.c +++ b/drivers/net/ethernet/amd/pds_core/devlink.c @@ -111,7 +111,8 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req, mutex_lock(&pdsc->devcmd_lock); err = pdsc_devcmd_locked(pdsc, &cmd, &comp, pdsc->devcmd_timeout * 2); - memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list)); + if (!err) + memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list)); mutex_unlock(&pdsc->devcmd_lock); if (err && err != -EIO) return err; diff --git a/drivers/net/ethernet/amd/pds_core/fw.c b/drivers/net/ethernet/amd/pds_core/fw.c index 90a811f3878a..fa626719e68d 100644 --- a/drivers/net/ethernet/amd/pds_core/fw.c +++ b/drivers/net/ethernet/amd/pds_core/fw.c @@ -107,6 +107,9 @@ int pdsc_firmware_update(struct pdsc *pdsc, const struct firmware *fw, dev_info(pdsc->dev, "Installing firmware\n"); + if (!pdsc->cmd_regs) + return -ENXIO; + dl = priv_to_devlink(pdsc); devlink_flash_update_status_notify(dl, "Preparing to flash", NULL, 0, 0); diff --git a/drivers/net/ethernet/amd/pds_core/main.c b/drivers/net/ethernet/amd/pds_core/main.c index 5172a5ad8ec6..05fdeb235e5f 100644 --- a/drivers/net/ethernet/amd/pds_core/main.c +++ b/drivers/net/ethernet/amd/pds_core/main.c @@ -37,6 +37,11 @@ static void pdsc_unmap_bars(struct pdsc *pdsc) struct pdsc_dev_bar *bars = pdsc->bars; unsigned int i; + pdsc->info_regs = NULL; + pdsc->cmd_regs = NULL; + pdsc->intr_status = NULL; + pdsc->intr_ctrl = NULL; + for (i = 0; i < PDS_CORE_BARS_MAX; i++) { if (bars[i].vaddr) pci_iounmap(pdsc->pdev, bars[i].vaddr); From patchwork Thu Jan 4 17:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5746149dyb; Thu, 4 Jan 2024 09:15:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFp+eXa/hLJezb8kBA1Ze/kI3jaW5L4WW8e2WawZo+//i+E95x5uG5bg0H4g4a5dmy1yReq X-Received: by 2002:a17:902:9690:b0:1d3:e6ee:c0c0 with SMTP id n16-20020a170902969000b001d3e6eec0c0mr875685plp.62.1704388528723; Thu, 04 Jan 2024 09:15:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388528; cv=pass; d=google.com; s=arc-20160816; b=fsgE3nhI/qvflXcZmwrT/i/iJdjK4/9k2O975HJxASPv0S70ms+67ojlukrzO1q2Pz 4T2drhMupo0FH952WoYH7lsaMfofJoPWZLV1nL1C0t9d5LcoZihgdYH6EXrxRN/YszmJ H9P3ZsxlleAfLSFBvYor5HJ1P4hErC3CMJyFdYCCoWw3R3OuqtVMEQ4FYtEl5KbSagvJ EUihv5CMl2QkSVAOSebYcw06fR+av3WHkggPwUcdxK+btE72eRCrtsJWzfE1zukcCn9+ qQ3ahVjiF/O6dnv0Eg4XMK1Rfx+tlNGriAox6us5da6duyVmQYxpGQ/hPX6/DFhWGGDX BS5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NVMyew+aAbLO2p6XK3nYqwrp0paEZ6on+b8/3CaJpi8=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=0M+rpkJx6Gbb/1kfZsYYLFe3tYXBZloeRd9Dd+d27x5dFMvgb3N+7CqnjkM/k8Rk3C SXnvf/tTjNZV2t/torZjUIXlQxqGpvBQQ4Dx5vzozyyCsshyHxcHimM1ksXlhhB1tGuy UH50Z5adSr1t8ADikQK62AaItaHusb+PsFUc/TofSgL1nx6bHr6vhIeTqJkgXxMF2iF2 muY7GByKLR8w2tQc4RTrAr/zgkaQepOx10RqNcppAHp4tHV/3oJjq3rGppO1jfrSWzZ4 TP9BeQMSr3WS0qw82XCwaz3sAx1LEEnc2FBhFPyIY/Yudj3d/xO6AL3uuAnZnoOc+kJV ij9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WzKylqBC; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16997-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16997-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g20-20020a170902869400b001c9c83947d1si23052038plo.645.2024.01.04.09.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16997-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=WzKylqBC; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16997-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16997-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8DCCE285C9B for ; Thu, 4 Jan 2024 17:15:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 828B42CCD9; Thu, 4 Jan 2024 17:12:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="WzKylqBC" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) (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 6BA612C693; Thu, 4 Jan 2024 17:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X45mPAtJNFdLmbzhWX9a0OINidweVVnk5TGXyO9SObQjXRQHNcBcMphg2AWdE3/N6wbH6pt+s5ieaUA54vUCgQXIQO3cFV7dWxAQEq3nRoJjAQcZi8ECmpWVWfVuAarEYFLplNtZAL3J84QFAr5jLtUe5iPdfcRdJTxCdMQdxJUOU+ig0TnzXP3i3R8ZFzP9Y0iRB425aNE90ddLecmEfo7+3txsnYzDPeKDUigMG/08q57OB2+m4SinzHwFwwgWaYZ5uJFBu+IkP7R4H0fApSxIrAKRROHgk4+b9AKgoNa632gVbpFNpFxw7pcdSzBWXa2F78u+eisJqF9wtFOZNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NVMyew+aAbLO2p6XK3nYqwrp0paEZ6on+b8/3CaJpi8=; b=jnSXGz3JIBqHpQm3oVviTTiz0ev8dZh8xaHKfvV8K3l2QVa5WWKThH2GDW/nun6enCULd/eEueC7zR7rj5kS6kA1iAPFDELNKoyWUjwWvfELUQKBrXdPh8CVAPT3HNQYlfTG4Nyx6r4r2NPa3+1XJeY3zzGOd0j1t98rV/fowvJ8OqNF4j9kkbAlHvUEMJV6Q5bPpIPYsh5POlniMnUmMvOcBfA/I7OVCbdFjIS0A7CfLUfX6xdro5pGFpg41+KXO0AlIGTcMd1iLMMEokaxSM6FwML+kWkasr49XQY427RTpX1jGE/vYRZA67xduyLBE1sZrTyIFNXbvMHl/OxpxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NVMyew+aAbLO2p6XK3nYqwrp0paEZ6on+b8/3CaJpi8=; b=WzKylqBCBsD49WeysrkveJ4Xi83/1qL50DLkgKLz+Bh3PTqBuuUG4qIIPP3f3ji27CbaaNzuxvsv5/n5o4XQbBUFUae1u1/xJ//MFIloz5CSRmzrjN0o3p7O2MmNbVLrjHyyBig8MdDrO8MeuCRjyqFgOipqO/atJ4U/tjxCFvg= Received: from DS7PR03CA0219.namprd03.prod.outlook.com (2603:10b6:5:3ba::14) by PH7PR12MB5687.namprd12.prod.outlook.com (2603:10b6:510:13e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 17:12:43 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::25) by DS7PR03CA0219.outlook.office365.com (2603:10b6:5:3ba::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15 via Frontend Transport; Thu, 4 Jan 2024 17:12:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:43 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:40 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 6/8] pds_core: Don't assign interrupt index/bound_intr to notifyq Date: Thu, 4 Jan 2024 09:12:19 -0800 Message-ID: <20240104171221.31399-7-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|PH7PR12MB5687:EE_ X-MS-Office365-Filtering-Correlation-Id: 43f96daa-fcad-45b6-d8a7-08dc0d485d7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qSmv5QA4V1VTIQEarP4YHaRCCUZnag9oy0LCcNWa9xUEFk1oMlbXhxi2RtUKKStbJ+B2YbTwf+sOQwTv5QZkSKW2hVB42FhlJVhxMBXRPMPJYUVXXLjQsJHFsnrbX90vaAY6WzdLIhB5NwYyBoJhtNRbpgK6V2NKMh1qJaOwTAERAbG66k1d7iNVp4EupqQRi9J8mE4DwunBbPOpYScRFvCm1duqaD2hLcq5nE51ldCKg9R3oRCr9nEuuHPHHw/2R7/VMaNEOuKATmMr0+inT9R83l3eh7adVyBDDpB891o5BTJrxb8qskiKrkRW9i+CjSGVmAhGhCWPBYF8cYx25AeS4BrlCiIaohyFrHoyI2Z8NaRu/pxI9NGe2FgsKBgNWRTevXBF9rSUKXrcLyPJgmhZlWcYoQlTHRkZZ8HXO8Sle2yf/CCG5HQK3OO+PgLMmOLVYztZoHCeBEfWttCJSPwA+NPzUW5g3tAXy+PAyxlV9Z2khlEN+Q9UlGhLIZtZS4CiigNQbEFdEalTn9BMiukdXBZSKN7qk4Zsp4263OqrD0565MnALULPaEX7eYflHlPksURW/y51uhq5tyDnC30UeeAzRV/SF2ju1laOGlBKCGvzcqpnAE4tG/BMdY/H+bi3SZrVvHhffmEZjHOOuwh5f3YfhtKAOm2/8kXQILhfmnzLUob+eHeNivPtnniMKYQ6NvBSwuvCiwO1/IA4/Q+JEdK8KwqtCQUwA62y5UOtIBZs/X0O0T3Xbx4aNomNMvHFAyiF//em/L9GYZbUpA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(478600001)(8676002)(8936002)(6666004)(70206006)(54906003)(110136005)(316002)(47076005)(2616005)(70586007)(36860700001)(26005)(1076003)(426003)(336012)(4326008)(16526019)(5660300002)(44832011)(2906002)(41300700001)(83380400001)(36756003)(82740400003)(81166007)(356005)(86362001)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:43.5449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43f96daa-fcad-45b6-d8a7-08dc0d485d7e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5687 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180906028593139 X-GMAIL-MSGID: 1787180906028593139 The notifyq rides on the adminq's interrupt, so there's no need to setup and/or access the notifyq's interrupt index or bound_intr. The driver sets the bound_intr using qcq->intx = -1 for the notifyq, but luckily nothing accesses that field for notifyq. Instead of expecting that remains the case, just clean up the notifyq's interrupt index and bound_intr fields. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/core.c | 5 +---- drivers/net/ethernet/amd/pds_core/debugfs.c | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 023a59c8e425..5426ab5de66b 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -129,6 +129,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq) if (index < 0) return index; qcq->intx = index; + qcq->cq.bound_intr = &pdsc->intr_info[index]; return 0; } @@ -222,7 +223,6 @@ int pdsc_qcq_alloc(struct pdsc *pdsc, unsigned int type, unsigned int index, goto err_out_free_irq; } - qcq->cq.bound_intr = &pdsc->intr_info[qcq->intx]; qcq->cq.num_descs = num_descs; qcq->cq.desc_size = cq_desc_size; qcq->cq.tail_idx = 0; @@ -433,9 +433,6 @@ int pdsc_setup(struct pdsc *pdsc, bool init) if (err) goto err_out_teardown; - /* NotifyQ rides on the AdminQ interrupt */ - pdsc->notifyqcq.intx = pdsc->adminqcq.intx; - /* Set up the Core with the AdminQ and NotifyQ info */ err = pdsc_core_init(pdsc); if (err) diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c index 8ec392299b7d..dd6aaeecfe0a 100644 --- a/drivers/net/ethernet/amd/pds_core/debugfs.c +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c @@ -105,7 +105,6 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) struct dentry *qcq_dentry, *q_dentry, *cq_dentry; struct dentry *intr_dentry; struct debugfs_regset32 *intr_ctrl_regset; - struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx]; struct pdsc_queue *q = &qcq->q; struct pdsc_cq *cq = &qcq->cq; @@ -143,6 +142,8 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) debugfs_create_u16("tail", 0400, cq_dentry, &cq->tail_idx); if (qcq->flags & PDS_CORE_QCQ_F_INTR) { + struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx]; + intr_dentry = debugfs_create_dir("intr", qcq->dentry); if (IS_ERR_OR_NULL(intr_dentry)) return; From patchwork Thu Jan 4 17:12:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5746541dyb; Thu, 4 Jan 2024 09:16:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhxf12gsM5zGYs4yeRNe2PAHMp6/TyhIEK1ODV10EoPc9Lz2lvt0JpHcMC3HB0Y+deRjkp X-Received: by 2002:a05:6122:368d:b0:4b6:ba77:5a9f with SMTP id ec13-20020a056122368d00b004b6ba775a9fmr658170vkb.13.1704388563278; Thu, 04 Jan 2024 09:16:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388563; cv=pass; d=google.com; s=arc-20160816; b=LNUf/q/qvWfgkt22/+OrNhnewNVHVXBwnAxlapS9ya9wHRuTsKIcIfKzDf534CoIQa m1ltaXtVjSQ+UHNaBCY7VV46A6FjONSEunkM+1VmfcPzy9XoY689EdJ7C76bjyarH6bl /CZq7m2j296HKKFgyVdoxK5m7+NrG2tiDvWsBvpXrNw3RIeGs20LaISba9gWGx2v5Jwr fK013nx5nOOw/a/IoHBlejNXuYD6+ph7EOv+XNWs+oB83cAgdNpGgw5feJ5nDJr+ZIkN DfMQbDnYOwnFwpi6bamtqP6FJ9gdQSiSlqZCQNyRDXl/9iyfquTFFu+ExfV+L6XQgjCD XrsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z22fZj2ZslWdm6XMDtUt/mFJgscRVo8cTrG8iqZ2EZ0=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=gcoyq764vNRhdigggoZGR3/m39v2YNnuBysOytIVxVps5hXiqMJ4RsQbCUc6ldrp/9 dRWZkEk6AdbLM7OD06RaNdpaEdr0oUsDwl6ZDauzplvLZvPdVyTsFIhefqXeDTvPhCvp 6SyRbbvLPVk7woa33RLzJIpYdXLtvBWj2q5NQTpyEiU885fSuSrQrITj/J1H9iv0KHW2 FnmUgZc/m2PWCmdyfGkgo57eJvRP9q/j9Is8VgVFHTWTxVz0QdKfiBCHd1SJyPuDIGCr 0dQ44dqlZqdVIOC6VetyLyNjLhhTQrFe3Ew7EDBsF+ktocJEUfLHZ/nk2CUyi4CZXsgy XIrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Z1WEPRj3; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16999-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16999-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c63-20020a1f4e42000000b004b6cdfbf751si3680778vkb.229.2024.01.04.09.16.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:16:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16999-ouuuleilei=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=@amd.com header.s=selector1 header.b=Z1WEPRj3; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-16999-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16999-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 EA1631C240E8 for ; Thu, 4 Jan 2024 17:16:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CFFF2D633; Thu, 4 Jan 2024 17:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Z1WEPRj3" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2064.outbound.protection.outlook.com [40.107.212.64]) (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 55ADD2C6A7; Thu, 4 Jan 2024 17:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZy9921I/cxsmM/mT4Nu6xs4pMk/lwFeuRuBCsfeR02Fk8/hcJfJEymeXQPRUeF5MV4aoT2wBMeg6kPblEI1/e9aHe9bBggIq6YZ6yOF/nTKyaLu4YwIBIimcuxe1Zp0tEnSH+hqRxql7Cyr9AGtjjo4ThNr51qb2dWhhclBuJ8JDHeBD6oQYQJnr4jVCcNvtLTdjaDvODffiCi1ogAB8MM6T7gqb+qn/Elw3PP6aL8KLpDMqHRhNnyFS703PFA0t7Kax5Zl3KZQO9ylpWOjnsYg0kfjzDOArVbXGPzUDqoqtNHnvXUY+YjL8FAKFt6rbEFN1JAP9DHrFYz53jasdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z22fZj2ZslWdm6XMDtUt/mFJgscRVo8cTrG8iqZ2EZ0=; b=dRkKKe7peQ6o3Was7qwl8tiCdI1hD5gfrsLdYXmeRa7+Le3dZejZyOJSjYxvkA8PfQzFrbCk1odBIZyrmd4nnC1jBN/J3OXMsOA71lAOpgq4zvHxeGDRMau55vR6G3+33H9z9D9GIn1UZgT3stRwsTvhL0G3lizuWuNeENXqMNbvwdj38tHlMvM91KyUP3z1C8Dmpws+Rfa3/G+S7tWCva/POt+QdblO/0wIn8TsIHAGOB1alF/11u10jjM0ulrQdkYClfa3FUz7Py4UdqbQDuuBiE6QcjmyWVhgHMhd7OZ0xsJuW7xYgNtDVZtojlIROxC4EKh4qjSu8AhY/wSPfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z22fZj2ZslWdm6XMDtUt/mFJgscRVo8cTrG8iqZ2EZ0=; b=Z1WEPRj3ymfCEHKMOvRxyh4KsV13E/6QHM2ExbNIuIYkgZnq/hkEAUrj/KhPVIpegTwOmc4Y6UCacBWuFpLU1Lr7k2jCscuYNa3ZVattrQZWJmXkds0cgtYbCS2bbZVbol2wT6Ae0Q/+FldkUXCfJP+bTxq/uVjaWMlfF3Gi2B0= Received: from DS7PR03CA0227.namprd03.prod.outlook.com (2603:10b6:5:3ba::22) by BL0PR12MB4916.namprd12.prod.outlook.com (2603:10b6:208:1ce::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 17:12:44 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::e6) by DS7PR03CA0227.outlook.office365.com (2603:10b6:5:3ba::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16 via Frontend Transport; Thu, 4 Jan 2024 17:12:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:44 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:41 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 7/8] pds_core: Unmask adminq interrupt in work thread Date: Thu, 4 Jan 2024 09:12:20 -0800 Message-ID: <20240104171221.31399-8-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|BL0PR12MB4916:EE_ X-MS-Office365-Filtering-Correlation-Id: dd5ec5b9-2a6a-457c-8611-08dc0d485dcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8UF4zK/v1626phqqoEAplBYhRsDH0UeLcou7dC10uAnRKk5ZdTRonpTYb5Z7PRL+6M9u9ehFzoVkhVFf3lXSEN1Q1fNpOpd4zoscDEG6pQJA+dvGwWRBNskBlvVgDl455IJsdlhtoAtzy/7l7H1pMt6QMdqOEmd+m/pjmmKSZXwP7/TFJ3gLD6KWaJDuZ013byFRS693uS8ScvxNdytjT432lEvFmuwX7cg8Wacge/HGpmxABG9dOHmdlzWA2HKVtMJJE5Mf8qjmOPNSwreNR3BSa32+PraslBH0fqLdYRdAya1/aQxByaBikK62dss/Vvk7cgJXuFeh/O1jYKqMb9b0R7XGTFZv1ffhqBkSwLCfIr9/D7PXzepjIS3hnE8HF1/4YNCw/RFc6uHHuX78Cm5Ps9p1kb5cPv+4NTwsZeyJfsbooRdrriVYQxoFnj6zo4IsREf//yQXLI9LU0kxfQJ/T4bc7q9ILxZg40WR7fr7MRITRR46T9Kqi7Qs3itIV5GZC+VT44tPg/OqzMXa9+aGJ2rs+HdPZAtZChmvJS+ZLO6JJNcvszrRg0iNJgOiaJlBz03u9DFb+OYjZ8WdGnPRgQ/vo1FCwd8lYeq+c+ifaWJP7QdlXm8O/bL1TVJwAfTY+KXirQ4EcaTnQ8/+onDirgA4F98Id3i9Xe8tZNPbz46YWiqG0PaCnea/UPMtPdbATTysUchsAWRQc6LjUFoREDFLOwZ5EPTPEivdJpsCttrjo4PkuFKf/UgrOaBrw9bXTb7NrFM/iJV+9sRsCA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(82310400011)(186009)(64100799003)(1800799012)(451199024)(36840700001)(40470700004)(46966006)(36860700001)(47076005)(40480700001)(1076003)(16526019)(426003)(26005)(2616005)(336012)(40460700003)(83380400001)(478600001)(41300700001)(6666004)(4326008)(70586007)(110136005)(70206006)(316002)(8936002)(54906003)(36756003)(8676002)(44832011)(82740400003)(81166007)(356005)(86362001)(2906002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:44.1387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd5ec5b9-2a6a-457c-8611-08dc0d485dcd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4916 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180942196572525 X-GMAIL-MSGID: 1787180942196572525 Unmasking the interrupt during the pdsc_adminq_isr is a bit early and could cause unnecessary interrupts. Instead always unmask after processing the adminq and notifyq in pdsc_work_thread()->pdsc_process_adminq(). Also, since we are always unmasking, there's no need for the local credits variable in pdsc_process_adminq(). Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/adminq.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/adminq.c b/drivers/net/ethernet/amd/pds_core/adminq.c index ea773cfa0af6..c83a0a80d533 100644 --- a/drivers/net/ethernet/amd/pds_core/adminq.c +++ b/drivers/net/ethernet/amd/pds_core/adminq.c @@ -82,7 +82,6 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) unsigned long irqflags; int nq_work = 0; int aq_work = 0; - int credits; /* Don't process AdminQ when it's not up */ if (!pdsc_adminq_inc_if_up(pdsc)) { @@ -128,11 +127,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) credits: /* Return the interrupt credits, one for each completion */ - credits = nq_work + aq_work; - if (credits) - pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx], - credits, - PDS_CORE_INTR_CRED_REARM); + pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx], + nq_work + aq_work, + PDS_CORE_INTR_CRED_REARM); refcount_dec(&pdsc->adminq_refcnt); } @@ -157,7 +154,6 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) qcq = &pdsc->adminqcq; queue_work(pdsc->wq, &qcq->work); - pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR); refcount_dec(&pdsc->adminq_refcnt); return IRQ_HANDLED; From patchwork Thu Jan 4 17:12:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 185087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5746785dyb; Thu, 4 Jan 2024 09:16:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYaExR1DG7RYi3AfAc8B0zvRppLHGVOv15nEzObzBJWuqItADoQpJNmMmAmz0MTk+dS+bW X-Received: by 2002:a05:6e02:1546:b0:35f:cd48:930f with SMTP id j6-20020a056e02154600b0035fcd48930fmr949296ilu.6.1704388584972; Thu, 04 Jan 2024 09:16:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704388584; cv=pass; d=google.com; s=arc-20160816; b=ixmrrH8VJiMc+BjYK3Nl+uNcZv5PVLbdoto8T7PFm0eZ9MfT79UCGDcAaJBYsve/cb 9tZRlnkgfCrMouSwjcfxu4zcYCptDjZdIoSMntmpHS75noHMswO9815jd9rLRBxqAsqP ftOmlTWr3JHdvW9KO0AX+UGhMo1QLNZ0UP2BG4/rR7PTtOxDGK/xZBkMG9OBtBAGkzqg YJ036faK6QjlGBv3Msg+BjIPpSEyj07jdYpGc9cNX91XdH2cuhfVrteGpPySHO0qypes WUg57eyhNhP0F3yKTVaLIbKA8hN+ClSh5k4yn1eTfmvnAHXrIhDhhAmhZodlXrkr1TXP +KQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z+OLxvq2DYP7wxZqyHKMOFqju/oZOkRXvow9JXosYx4=; fh=kgzY7QzQOE45kE1ZS68gHVk0HzxFcd8Wjpz91VcjYoE=; b=KcPyjq3doz2dHger+ilSA81lxvN+0jAZrcUHjjxSXaORREx/nEKrV8BnKZRV9JRhGC vOJH6A/GYk4+YkuIK2uqvMLLpvtz5U1QMKgnljJJ2hm5tGMkG9vdP+4PUb7IbcuahdU/ U3suhMmhbSmLpS76ZDmXXlBJQMQCMjI3j5Oup3RQj7cqD0bCSafYVkUwHQIprKwIeQML xsGlqjK2Gjh05uWojuF8Q+e3Hasv2J5AzO7EvQCPkazoOIJhw9DPHueEeMtaBZwIQUMO gk1du1co4wzvEYvIBhFhf7QJRBVmN4JgOSZljCtvHyVmrO1XU/Tq1hTGri8WRJ8cRNci kX4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TtyjPl4D; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-17000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17000-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c24-20020a63ef58000000b005cdfcb3908bsi20811790pgk.316.2024.01.04.09.16.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 09:16:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TtyjPl4D; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-17000-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17000-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 12214B2136E for ; Thu, 4 Jan 2024 17:16:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4C0C2D63F; Thu, 4 Jan 2024 17:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TtyjPl4D" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) (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 8A2C12C6B0; Thu, 4 Jan 2024 17:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VFmVJeyC6cTbpLOu7+E8eAZTVTO/dx7j8K+dQmirFeHcxy2enrNfyFitI3xAQd9iAUuQANh5xJAiJSgEyavNvxLzv7BaubKLgpmRhvMb1oX4nLtxb78CeOo8jXikvHzzbnaMkBYSyRl50N0s08Rk+Zu5fMhaWuzp4ozAbdSR7c00GW0vB7y2xoEK3zcGV9uOnl+VQncuCFzAw9B3x1sfKDIyIBmTOJj1TDUCgEvge3e7a2lG2WLIUpJ/513B+16//xhVPgU4YLxE7TMjdtI69tCaYfYpIoNxxfldNGdIiuX/IWgStZZBpdJa1hE0jFzsOrDyPb1UYZsWPVAhR5UaLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z+OLxvq2DYP7wxZqyHKMOFqju/oZOkRXvow9JXosYx4=; b=NEKGU/VygSl5LKZEjO9gE+LwH8gPlhMISrhbeA2PJHGy6S4WZFtLk0eCQZIQMtCdCcsJlFL+fnwgCmunw0VnLOoTODwUQMvfM1pE5neQmZcnL6qGAYcW9CSvnDi82c1e10tODeLvJsqBqTmqaEt1E5xJZe1KNxxNFLilWbz7kM5nxXFxjSbjW2PinEeyTFdfEMoXq+AQYFQXzK/ulJpF+mWDIpC+9nafyMM2QDXRIHoHMOcSVfccSEzOGSzvzEOxLTLPUcpeEZ0ExUzmu73ibqkjbfSJBUSfvm5Ffj6zq+BiAZ0/fa8TfRKiS+9dkzGIZW5rTBi5Z5H8laLXcMBs5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z+OLxvq2DYP7wxZqyHKMOFqju/oZOkRXvow9JXosYx4=; b=TtyjPl4DPe/4cjPl+3PTO93PkJQO9nnAG1fxVodDrnSfhMjxl7MjimdZrNMbnR5qanBKOTA3qlgq3WLl6BvFxFs7gpUDL4Jp95FOrp8SCmnM7xirveIUYsbadFd56eeVcIEYzXHBhQp1slc4NE+d2OiMio1HyPCn4xENV1KaKIA= Received: from DS7PR03CA0214.namprd03.prod.outlook.com (2603:10b6:5:3ba::9) by DS7PR12MB6143.namprd12.prod.outlook.com (2603:10b6:8:99::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13; Thu, 4 Jan 2024 17:12:44 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:3ba:cafe::a6) by DS7PR03CA0214.outlook.office365.com (2603:10b6:5:3ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 17:12:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 17:12:44 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 4 Jan 2024 11:12:42 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 8/8] pds_core: Fix up some RCT issues Date: Thu, 4 Jan 2024 09:12:21 -0800 Message-ID: <20240104171221.31399-9-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240104171221.31399-1-brett.creeley@amd.com> References: <20240104171221.31399-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D7:EE_|DS7PR12MB6143:EE_ X-MS-Office365-Filtering-Correlation-Id: 037ef2c4-4ad6-442a-822e-08dc0d485e2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wvIlY/UWxwnpR1F/qk2/aQIWoxE1y2dtGR4dm0JmB8P445luUx98+YSFzE3XdswMbD9zYhNak1t+su7d6CS3naM88iroD52pDIZ6jSs6qbltJ06wEA3fNUpuBdvqig4/2SaajTvtchFzcnwRei8cRDarhcYYqBSkWI/cv1kiikyW8BJpGMol9v7NPItBuJa7W096rIy6GnXMJDubqQd2oxTA4PWmKAgE4L0v5dPXkhSDc494ePptZG8EAHe/elmR/IVC7PX0LFoIigJ8PUGDBHI0MN6jEzDwRD4tDx2133JVzI/XTZ5fdQ3nUWnEK7QnNbC4OYjg1Ai2M0On6q29mvCHHMw4Ym/6XgrxzJWNcAb4/K9Dz0VbhfyAeRAzRys2BDYasH7jBdP2ZVKYuX7SerbaP6KzQewcnrd5cLKcDDtXOsTZ+nRR+4lN8BZv6qo8O3CouYUX+EDrZDJAuKrSm/wzaqvs+J6oZ4HACdtALzM+cdpwV2QUGWxKo2wrTbQyF3Y7JhC1iNhkQu2UB1WQuW0y7cJZLJjYg1q3tXQdjifEs0gT+6SUgGdZKB7jAOXIrCcBSjP9GepT8c5ztJpC0WhgCTB5IywjouTP+9kt4W9uy6NPxUL1bvNVOVrTqgpSNlV3FW8rtw7BdDNmz1+deJF6LlRtUvliUpjD9j5GIuk5fmUXzTIkCWCpnlRjUArXOVTVF2cHVL3wgN+WQ7ymUpSFycoMoA0kvS5Gdl7CfmRfg7cHSQtCnNm+pJS42QEjKbYWNUUwh515HiL4qDYWpw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(39860400002)(136003)(396003)(376002)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(1076003)(2616005)(26005)(4326008)(83380400001)(47076005)(41300700001)(2906002)(81166007)(356005)(82740400003)(5660300002)(316002)(54906003)(8936002)(110136005)(36860700001)(8676002)(44832011)(6666004)(478600001)(70586007)(70206006)(336012)(426003)(16526019)(86362001)(36756003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 17:12:44.6855 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 037ef2c4-4ad6-442a-822e-08dc0d485e2a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6143 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787180964352468890 X-GMAIL-MSGID: 1787180964352468890 Running xmastree.py against the driver found some RCT issues, so fix them. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/debugfs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c index dd6aaeecfe0a..d56fdbb4cdb9 100644 --- a/drivers/net/ethernet/amd/pds_core/debugfs.c +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c @@ -32,8 +32,8 @@ void pdsc_debugfs_del_dev(struct pdsc *pdsc) static int identity_show(struct seq_file *seq, void *v) { - struct pdsc *pdsc = seq->private; struct pds_core_dev_identity *ident; + struct pdsc *pdsc = seq->private; int vt; ident = &pdsc->dev_ident; @@ -102,8 +102,7 @@ static const struct debugfs_reg32 intr_ctrl_regs[] = { void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) { - struct dentry *qcq_dentry, *q_dentry, *cq_dentry; - struct dentry *intr_dentry; + struct dentry *qcq_dentry, *q_dentry, *cq_dentry, *intr_dentry; struct debugfs_regset32 *intr_ctrl_regset; struct pdsc_queue *q = &qcq->q; struct pdsc_cq *cq = &qcq->cq;