From patchwork Fri Jun 24 02:45:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12893318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 617FCCCA47C for ; Fri, 24 Jun 2022 02:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbiFXCpW (ORCPT ); Thu, 23 Jun 2022 22:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiFXCpU (ORCPT ); Thu, 23 Jun 2022 22:45:20 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D2C056757; Thu, 23 Jun 2022 19:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656038720; x=1687574720; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=N/JOWKmPpe5WKo3XhKj8F1LmPUZK/Z0aEj5Tw/CgYxY=; b=erSUCTuv23hw+JBsBjpm5MnBSzLndyfDYRJpI9CXPc+N6+Q1PZHG0otw EKGMxrgjEF907dWQrIaCV8UABLWjqny8BmiQbGnpYgpbA+9FYkQRFR1Ci LcrGstq7wknExHxadehKJyDPy6nqNs2n2zFYq6y1M3OhjqFIJNU0AEspb aAiEH+jfCtzhb438St797hDgoecUMhgiFyySb7q/AB+Dwt0XREJC0Z4RU kZqYWGcs0xnbaO9m4/O21FgIMOVQ+4TSwsbzgfWd0uxKbOPJA0y9RH+ja TFMM6WguqWJvqc8Xl31VnEwg+Pnhk22QmtXt8oKzqI1VWg2GxOyyWG1GA g==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="260721924" X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="260721924" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:45:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="834933150" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 23 Jun 2022 19:45:19 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 23 Jun 2022 19:45:19 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 23 Jun 2022 19:45:19 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 23 Jun 2022 19:45:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jq2UWMmaKuiYRsQXlSjXK7hapjovIwd6lI5uw8wvkUDBAxhLTPlo73nupqRO6C4vxOtUVOQWk0fG9P0Iu4EhV7RVt1M6Bh+WGsh/0Vh1YtfY1uo0woMP8ZcQPYSiNeRRdXeyeVnDf7G932yOWCyknTmr5YDnm1iU8EirXJdv6N3CPUQ7NDTDDrB4LPRAQlKz2Yw1mz9BbtSW0kWEGi64iZaK22cakdqmIuVN5DetDD8tu8fwmgNNA1D0Jip9VePDPoSgsufGswcQUPb/3IuLfCsru4eYhRzBNBWmx7YK+JtoJiuKCBBvGEaW/bsLzKW8P95oDpUKthIVMCxVPV7vWg== 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=Ntl9wxR6g4xykERacCZePKsROjjbl6kQ/gOWEUt1qPE=; b=DW2ZrJTBnL1gZOwxa6IWw54HiQbqWqHllHFYhVDUMv2Y4pXxJFWWhoJs/vUS2Gaoj0GYNM4lvZVCZgDGFRPL7rhmIkMZMEvY6r+gwKQthhdJJGI1k2sF8xHubNbhNXHNWTqEhS7FjhiLVXK2xqmh4sIxIGR/BHpLOfBYHD54v5or7fvf4lYJbswklUc5xwaqahW/MdSdYmU5NywFlT+kQu91M1iagVIMQYY/xKRPKDO/30Z0OkkcbGJoX6KUh4YUqQBys5pKZP0ed/+B4GVMXGhNn6qsdIYvLLiWQLt3K2dc2Q6Chk2VLUxJov+RBJqzMcpemSMhvwiCGhSb6PtRNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR1101MB2126.namprd11.prod.outlook.com (2603:10b6:301:50::20) by BYAPR11MB2789.namprd11.prod.outlook.com (2603:10b6:a02:cc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Fri, 24 Jun 2022 02:45:16 +0000 Received: from MWHPR1101MB2126.namprd11.prod.outlook.com ([fe80::f50c:6e72:c8aa:8dbf]) by MWHPR1101MB2126.namprd11.prod.outlook.com ([fe80::f50c:6e72:c8aa:8dbf%7]) with mapi id 15.20.5353.022; Fri, 24 Jun 2022 02:45:16 +0000 Date: Thu, 23 Jun 2022 19:45:14 -0700 From: Dan Williams To: CC: , , , , Subject: [PATCH 02/46] cxl/port: Keep port->uport valid for the entire life of a port Message-ID: <165603871491.551046.6682199179541194356.stgit@dwillia2-xfh> References: <165603869943.551046.3498980330327696732.stgit@dwillia2-xfh> Content-Disposition: inline In-Reply-To: <165603869943.551046.3498980330327696732.stgit@dwillia2-xfh> User-Agent: StGit/0.18-3-g996c X-ClientProxiedBy: MWHPR19CA0064.namprd19.prod.outlook.com (2603:10b6:300:94::26) To MWHPR1101MB2126.namprd11.prod.outlook.com (2603:10b6:301:50::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa050fff-26cb-4f7e-c552-08da558b91fe X-MS-TrafficTypeDiagnostic: BYAPR11MB2789:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ARnRUkP6uWzLqlqy9Mptm4E0fqzCfOy0GUrvnv7s+lplsIyjECc1aq9mXDfgU3RzwnAE87JH/+zv8ryKZ1UECasGQZgkCd/ifEyguXtghEouO0Lvxr9fTCDZTUywXov8b55XHffE9f+BZHjpdPC0sh+u/fFtCK3lSztZ9/MhhleZx96LbKbMvS4ANGJ8f3qXfOd4L5mymLpbFKKoIbkKjRHFqblN+cysmMIAo7bFpiL/wjcmyx75ua8tmFYssc9CUQHe58OE9hdJTpQDgj+MP9c3uIFtXFWZt93rgiio6MxdpQQ65AG0r51/0p328D2jUcWVtuE1tauNc1EaJKWzK+Cnu80rH0I8VP20/nftoqj8Qu23GjuOfF1cEeLK/eVFf9dTvLK37cmfWJMyTmA4oz49my3Sr2Ek5F1yqD2JTZc6g2DnpIGipR82aOfU3h6XS2pnbH4Vjd3vEy0AAMSRy+Plbo4tj6hR/IGV2fGQ+CoDQmJ0RYavcLwXfJhKkk8q8oEQWCMPGJBzLq9v4a5Pkl2VgjeNsr/X+gMREttPS3GJDE2rdqf0UMQ8JEt3EJV6JiqeKX321dAwKYkIg1IdAJ+ABIZYkKtTjtvFfkjpjw6Bu3GlPOOq4erekVaOKFEPEUY98kBZ8UFNQCqLO0dNhBIF5BtGouewaUOscwO0MavqDjZl8upaVC4B4EcIYbYVIFpTPJcKc8+Osu6Y9WSW6e9S3CWPBxBhpxo8a3BGKke+x+2xvtwl3Azl6lUgbRHD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2126.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(376002)(396003)(39860400002)(346002)(136003)(366004)(186003)(41300700001)(316002)(83380400001)(8936002)(86362001)(103116003)(478600001)(26005)(5660300002)(2906002)(6486002)(6916009)(33716001)(66476007)(66556008)(9686003)(8676002)(6506007)(6512007)(66946007)(82960400001)(4326008)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DeweV4nKjfdOECP7rVh+/7QY+po/h8kMx1C9UFfs8UpM7Qz2H0wEyZFZzh0WHfI5aOWc1AeAVWpeg4R1xb0cv0aNZ6o6C1pMNg6e5vwXQTiZmfm9R7v0/jdMhp2tdWAcGk1zDW0/sV7w2kIkm9dVYRG30rXHevSS/DZX67YApe1vujQ6S9UTVXfeUGgC6Unw6sZYsBL7NX/IMIevnILjrOKpA2gYRMPNexRMS+rgZGh5xX+CRgJLH35yr8DhUyUzJM1/39KbiPGHSXyfpfBbVBKqDPlIEY6IgrrRJ5NW/9BntKK6Et4i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El6DpSQm+/MGwaO8YVSBepZ7hJqHCM3CGDQ+cqlCwKIr2nrxY/3sMYNWda+I7A696ei5PxDZQpV812otGpGcd+kFap4NeQWmj7HmxizM3+5YPfmtM/rklqY7M5YmDKy403NcGdaTcCiWeAuzLDm9k01OKWYEa7Xn9Lewl3WkYj0KAnRFOOmbZixHLIe1GoY0iZjevCTQhAcl8aLyQ96fkBylmeEjd4e3zXGGtj4aBIhQ== X-MS-Exchange-CrossTenant-Network-Message-Id: aa050fff-26cb-4f7e-c552-08da558b91fe X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2126.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 02:45:16.5960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6aPjgwhcV+N8a0LydJwR4jry5y1VYrg/0G/1HyjpBZQyqP8QSBnAUExk+gwxkTOFElO66Ri/rEOC7psnmbas6pSClvXTnJrptmr/rqehvL0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2789 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The upcoming region provisioning implementation has a need to dereference port->uport during the port unregister flow. Specifically, endpoint decoders need to be able to lookup their corresponding memdev via port->uport. The existing ->dead flag was added for cases where the core was committed to tearing down the port, but needed to drop locks before calling device_unregister(). Reuse that flag to indicate to delete_endpoint() that it has no "release action" work to do as unregister_port() will handle it. Fixes: 8dd2bc0f8e02 ("cxl/mem: Add the cxl_mem driver") Signed-off-by: Dan Williams Reviewed-by: Alison Schofield --- drivers/cxl/core/port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index dbce99bdffab..7810d1a8369b 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -370,7 +370,7 @@ static void unregister_port(void *_port) lock_dev = &parent->dev; device_lock_assert(lock_dev); - port->uport = NULL; + port->dead = true; device_unregister(&port->dev); } @@ -857,7 +857,7 @@ static void delete_endpoint(void *data) parent = &parent_port->dev; device_lock(parent); - if (parent->driver && endpoint->uport) { + if (parent->driver && !endpoint->dead) { devm_release_action(parent, cxl_unlink_uport, endpoint); devm_release_action(parent, unregister_port, endpoint); }