From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 01C3F1D682 for ; Mon, 9 Oct 2023 16:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E0B19C for ; Mon, 9 Oct 2023 09:46:29 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4S44ct20SNz6K6Jp; Tue, 10 Oct 2023 00:44:30 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 9 Oct 2023 17:46:24 +0100 Date: Mon, 9 Oct 2023 17:46:24 +0100 From: Jonathan Cameron To: Dan Williams CC: , Davidlohr Bueso Subject: Re: [PATCH v3 07/10] cxl/memdev: Fix sanitize vs decoder setup locking Message-ID: <20231009174624.00000bd7@Huawei.com> In-Reply-To: <169657719974.1491153.15276451196916291864.stgit@dwillia2-xfh.jf.intel.com> References: <169657715790.1491153.3612164287133860191.stgit@dwillia2-xfh.jf.intel.com> <169657719974.1491153.15276451196916291864.stgit@dwillia2-xfh.jf.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500002.china.huawei.com (7.191.160.78) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Fri, 06 Oct 2023 00:26:39 -0700 Dan Williams wrote: > The sanitize operation is destructive and the expectation is that the > device is unmapped while in progress. The current implementation does a > lockless check for decoders being active, but then does nothing to > prevent decoders from racing to be committed. Introduce state tracking > to resolve this race. > > This incidentally cleans up unpriveleged userspace from triggering mmio > read cycles by spinning on reading the 'securiry/state' attribute. Which Needs a spell check. security > at a minimum is a waste since the kernel state machine can cache the > completion result. > > Lastly cxl_mem_sanitize() was mistakenly marked EXPORT_SYMBOL() in the > original implementation, but an export was never required. > > Fixes: 0c36b6ad436a ("cxl/mbox: Add sanitization handling machinery") > Cc: Davidlohr Bueso > Signed-off-by: Dan Williams