Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4536335pxf; Tue, 30 Mar 2021 10:05:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/jcPy/wMM359a0w9Ie/KtkIQRiGF0hqowRGeWc+GPbJGLVmJhUWjDXZngNe0qqx/nIua1 X-Received: by 2002:a17:907:76c7:: with SMTP id kf7mr33875263ejc.470.1617123923317; Tue, 30 Mar 2021 10:05:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617123923; cv=pass; d=google.com; s=arc-20160816; b=O8okhTje3vwcDcFEHdBpt5q/sZxP8fUl3EZ09DIIU1nuFdEZ7nlvLlnaGZZEs7r79k qa5QWlUdB2gDZ8iihzTD5WgehXQRPzgxSD2mFAN45qP8Qx2j3bSfEQYumRTawYSrLeMd MfCgQT8bDmybfkajMuqKoBkHlehSftLxMR2MP9pl7p+LUQYkdVRa/3adEPCJQBw7WHIY V8ps1Lf93pkfC2/M3fGMfpSZj8H2gdGf9FHBzi28AmE3++XCPw+qVqJVT4oBDw2UHKAA Pe9FKL0B6cuFCbTodAl0x5NJM/YZTdooDg3aLOGIQaTbeNcTkislJ2EXDiyBs5Udzm4m Yv9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v4Ts0oQHR1N6hKJhAV8mgCIvXyOia4GdET1lTYfnyQI=; b=D1Fql8lwd3tXX+33+v3teaXBOASCHdAXFpT4toI4iZS+3AIgl0WwoWFu2QKnNErz4h ooT14k8a8gmpnHsKYEZE4IWi8zBsngrAnzbrcCxIZUE9ZdGOjuLcJC502JEfG5hEAbFu 6ecZW/YGppsd5K+rLRxE+yDEIBg3Xe7jeOEm8AR9eWXKTq4gul/SbNhfFLe2Ahe2W5VW Qxt2gfr7PTnTL/9AfL2fYdB32vAQgeYxWW1/OUo1zbp4Wm4CSUEvAZh7MQBgbLsSUYxQ zQsaiwKV0nwX/zzlWjmNreS5TkGQahOQUvS7B7kp1JQir9tdmgMsRIpYkcn/+3L7dA49 48+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=VGvlEfUE; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si16264195edx.282.2021.03.30.10.05.00; Tue, 30 Mar 2021 10:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=VGvlEfUE; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbhC3RDq (ORCPT + 99 others); Tue, 30 Mar 2021 13:03:46 -0400 Received: from mail-eopbgr770049.outbound.protection.outlook.com ([40.107.77.49]:63733 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232250AbhC3RC4 (ORCPT ); Tue, 30 Mar 2021 13:02:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IOLJSUhQp4/MGpzk865LMYt1Q5CHZW0yjZA+NTXOBFnUCnZhLT54BNlcjvkCb4vdX/IyrC0G3vNq6WNvTQa4aEsOGj4nmLeIebSmkEl4w5hwJfwy8v6blfHsrk+GKnLei5eTD2w4YZBp9RExmnHOlCUPq0UpDZf1A2fsXxxjMhiKd10nMixF+F0R9Y35QETuXOBg/PiwOZ+FsxiBZKHxcwvNiinfRVXsg/5yfaFeG7UfvluxP1rCz5XAnjz4iQ0Rg50nD2kmNPK0ce6xAPz1injRYjmHyQIS4MzQfpgxGJT6Fm8cI2emfVUBrs+ItaHc1WK+lswhBlVhnJu4rx4H2Q== 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-SenderADCheck; bh=v4Ts0oQHR1N6hKJhAV8mgCIvXyOia4GdET1lTYfnyQI=; b=Nqt55wlmX15E0Q5TrAX1zFfXCSNU2W2fmFaI4EVkqAJ7v/oSUmieAmwdP18Y9Fj3y0aS0JWPdF74ABn2LMRXtGRxTiAQnt6oiqqyWhe4XzFP8FBzD1QSZB2zEdVamp8LnbkYu65DlsA/nxiQ537wlhIp2pMoRJzX1KVtF5pfpgtnk4IkUpJvUM0OM1FphbP2sTw4X7yD3vL6i1IcrqepIjldjy9NzdwCm5aK8kp7Avj8cPSal8W4yrmd4vkqow6mYf2GCMIe2FjSYQRW0sm9eD+AegRv9R162ung88si6BpVT0E9Gx2m40mayfFQV5MvcY2liZMmx9Br1h4iCCfhdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v4Ts0oQHR1N6hKJhAV8mgCIvXyOia4GdET1lTYfnyQI=; b=VGvlEfUEak4YpvcCJSzdHPErYVFAjLpDfIjDqb5RHvJGpuvGJyVf+iEZOhfYfirIysJc9YKNdJRZSxUD/lBZ8r1m66q1FR2ylLCQkLorYjUgNzvFtyTJvuidRqrTSepb+4eNhX1lW7R1y6Zrfr51b/uYqR619eVjFMgZZ2sYXe4eAFb4OQo2L2XGobADDeKL7vUmpibxCTqvwYm7WP1NgrtMRsTQ/dxkmfw3Gqw7ueBhfR4DF5TmOM6PkHkfg0bQLocZHzVGrSXW8IRKIFWPH3Hl6L3k3qGQ5aNw/bf0e1D6oK6j8NqAgfcbJ5cCoOTxZrXTmHmW9M2rCQELbGpZOA== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM6PR12MB3019.namprd12.prod.outlook.com (2603:10b6:5:3d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Tue, 30 Mar 2021 17:02:54 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3977.033; Tue, 30 Mar 2021 17:02:54 +0000 Date: Tue, 30 Mar 2021 14:02:53 -0300 From: Jason Gunthorpe To: Dan Williams Cc: linux-cxl@vger.kernel.org, Linux Kernel Mailing List , Vishal L Verma , "Weiny, Ira" , "Schofield, Alison" Subject: Re: [PATCH v2 2/4] cxl/mem: Fix synchronization mechanism for device removal vs ioctl operations Message-ID: <20210330170253.GU2356281@nvidia.com> References: <161707245893.2072157.6743322596719518693.stgit@dwillia2-desk3.amr.corp.intel.com> <161707246948.2072157.2116502455691653472.stgit@dwillia2-desk3.amr.corp.intel.com> <20210330111620.GK2356281@nvidia.com> <20210330154712.GR2356281@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: MN2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:208:d4::21) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by MN2PR04CA0008.namprd04.prod.outlook.com (2603:10b6:208:d4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26 via Frontend Transport; Tue, 30 Mar 2021 17:02:54 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lRHlV-005xOj-1J; Tue, 30 Mar 2021 14:02:53 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64bdb86b-7957-4d12-f611-08d8f39da8f9 X-MS-TrafficTypeDiagnostic: DM6PR12MB3019: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fZjLBelX7Cjo1vAO3Dd5wLXxzpSm8l2PI4BBHEsz1KFDR66V5CTCoYHfn2LJei9dr2Cn34JllfCtIybiCc2KRe8axBa+M5CmVFUu3QIAYCc7EkiG/eXIj9u4hy9WlrBqlIfP5CsTUfAaw4OSWZiXGC09kAmc9i/Dmt7iEGZJMhbkf0IIoXc3TGukC5kowPLhaErn+W4VMICAHKZ2CDB8IV8u89RCkif5ASeKTPs497ePcI9d4kyipGEohTYAVCSLaFzSwQEOlPdi04zK5MFHgIBKsxrdSEuLsCBonmVAb78IsmPsskX5fks1YyLeRiHnxuL7t12L+vZpYTNMYXdSXZeGjruKhGH8Dd/I+HgxY3iSwCSiDRxDwyXRyERx9T/hsZplATWa4Yz0kVzaTBxMiu9dNuLxhlvbBnsmbr4pC7XYECfuV5SrMwVKHoywrQu8dWWWDVSSP7JCvvrbYqXvhf559sd4SxjOGCKA+ZAculHXFfQjC2bUP/MsRSLvto4MowoYCu1VEA2KSCrWsyxLBA4tDx2G6uPHv+cCB0OLEBXtJIeCk7bnQ0tPW9B0PV4jGblMYsMdwUo4RgwGJxzVgaxkix78LbHyJpj60gTPZn2ZBlOmu5Fy2Wf6eA7doiSKy0q/VscTph9KYY0K1VZj2LNuMK162yXWmwpfbUgoNzQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(366004)(39860400002)(376002)(346002)(316002)(66556008)(66476007)(66946007)(1076003)(426003)(2906002)(2616005)(54906003)(4744005)(8936002)(4326008)(9786002)(86362001)(36756003)(38100700001)(6916009)(186003)(83380400001)(8676002)(26005)(33656002)(5660300002)(478600001)(9746002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?TCnONsnE9V2FUyBQGS9lI/X+XDfruRqdeYhLgcjZLqEMJ+b614RTzfcHNdHK?= =?us-ascii?Q?g7v97MJiRIOeYOnlLhhmeAF8SJ2w0ifAh/W9n04k4bfPOlBshbbnBNt1z8F7?= =?us-ascii?Q?Ucsk4V15EgAX0hsir3K25IKjQUSJg9hs1rxBeUIxTCLglo4lx+d/RlNrkg2d?= =?us-ascii?Q?vl5Pd57rlbfb5ySVNDbq1qZDyaOGYOG8nSI2GVIU/JaOPl/0uZVWObPcz00j?= =?us-ascii?Q?wGNcIQct3kbp4/bc5xQbZRdzSVl/4JNxjSQCWLQb0gwsYC63D6V+VcTWYN3t?= =?us-ascii?Q?B2KGgMbgWd/ITrjoOUE5KWCHt6U3JuMBg7oadyYp66teEkLE/T4GqQTAOCec?= =?us-ascii?Q?8CiPF2mfGwrOqXn1zbG25iWYTSpUsH2cJZUJERE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Cq3w4DG88e4PCX9Orgv99v+hpejaZM8BV62S4yTQiOW3OCWgWJ?= =?us-ascii?Q?9flI0029/0Bn60dF3Uzovv7GbLlT0Aj2iqLa+V0ohNlfqw=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64bdb86b-7957-4d12-f611-08d8f39da8f9 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2021 17:02:54.4763 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hFZSKybsaftvk49EMQfkEfyWFZGn2LMSQ70rXiNGLVfewiABwYFogH/7WXt82yli X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3019 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 09:05:29AM -0700, Dan Williams wrote: > > If you can't clearly point to the *data* under RCU protection it is > > being used wrong. > > Agree. > > The data being protected is the value of > dev->kobj.state_in_sysfs. The So where is that read under: + idx = srcu_read_lock(&cxl_memdev_srcu); + rc = __cxl_memdev_ioctl(cxlmd, cmd, arg); + srcu_read_unlock(&cxl_memdev_srcu, idx); ? It can't read the RCU protected data outside the RCU critical region, and it can't read/write RCU protected data without using the helper macros which insert the required barriers. IMHO this can't use 'dev->kobj.state_in_sysfs' as the RCU protected data. Jason