Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp43585lqo; Thu, 9 May 2024 12:03:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZpcTX8ikthVLIghILUPtXVXY/SCTXVQV0i5GGGX6cfzsnS5AzvsYyrfXZF5Ls8ypIzN7bv9c7W0n2zWRP9PP+CAbIZUVnUZtUztmesw== X-Google-Smtp-Source: AGHT+IHZQsKO8Sc5kAZ7cBKl7pd9aT+zWFP0SFyVjYPhblLRaKIny8FBr8KGufaIlxI/wZSDRUgr X-Received: by 2002:a05:6402:2801:b0:572:aed3:a1b1 with SMTP id 4fb4d7f45d1cf-5733294b485mr3667636a12.17.1715281381395; Thu, 09 May 2024 12:03:01 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c3731dasi1083010a12.591.2024.05.09.12.03.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 12:03:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-174797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=easystack.cn 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 24C741F23C44 for ; Thu, 9 May 2024 19:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A01217F48A; Thu, 9 May 2024 19:02:51 +0000 (UTC) Received: from mail-m17229.xmail.ntesmail.com (mail-m17229.xmail.ntesmail.com [45.195.17.229]) (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 B4C25653; Thu, 9 May 2024 19:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.195.17.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715281371; cv=none; b=gS5RyhTAP0IP17+deH6yEFXsfqsGgf2RNAZJDnbwXAijRn9SHbH3AGwPd+DrJsHNRR2q7jQfZk2KWbrliNvn+HTEFqxwxBy3IywJeFvt1GCRtHzzh6Rzzv9JwKnqjJjqJoUozOVusIA5u6kIc0xufq20pEVjdN92Rbueof8ENSs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715281371; c=relaxed/simple; bh=4XnBz2lh+7YxriUGIom+RcfBIR64ijJxolblnDjagBQ=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=CHchWtgmZK1r13FgNAiQNW2n+e5sa19I/i7JXuPU/TJT4shnsV4SCOurfsQ1Pcj5ZOz1IRGL0/SEYOsA4tiKjfiKNl+HWBvis6IF5kWHE8f1LPEfnN5HXzOSS8tBaO2rSwrXpZgZILv9EA4/MoRd0na1kWtUvfdu07zASnvvGds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=easystack.cn; spf=none smtp.mailfrom=easystack.cn; arc=none smtp.client-ip=45.195.17.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=easystack.cn Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=easystack.cn Received: from [192.168.122.189] (unknown [218.94.118.90]) by smtp.qiye.163.com (Hmail) with ESMTPA id 0F263860417; Thu, 9 May 2024 21:03:43 +0800 (CST) Subject: Re: [PATCH RFC 0/7] block: Introduce CBD (CXL Block Device) To: Jonathan Cameron Cc: John Groves , Dan Williams , Gregory Price , axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev References: <20240422071606.52637-1-dongsheng.yang@easystack.cn> <66288ac38b770_a96f294c6@dwillia2-mobl3.amr.corp.intel.com.notmuch> <98ae27ff-b01a-761d-c1c6-39911a000268@easystack.cn> <8f373165-dd2b-906f-96da-41be9f27c208@easystack.cn> <20240503105245.00003676@Huawei.com> <5b7f3700-aeee-15af-59a7-8e271a89c850@easystack.cn> <20240508131125.00003d2b@Huawei.com> <20240508164417.00006c69@Huawei.com> <3d547577-e8f2-8765-0f63-07d1700fcefc@easystack.cn> <20240509132134.00000ae9@Huawei.com> From: Dongsheng Yang Message-ID: Date: Thu, 9 May 2024 21:03:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240509132134.00000ae9@Huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFJQjdXWS1ZQUlXWQ8JGhUIEh9ZQVlDGUNNVh1KTB0eSx8ZS0wZSFUZERMWGhIXJBQOD1 lXWRgSC1lBWUlKQ1VCT1VKSkNVQktZV1kWGg8SFR0UWUFZT0tIVUpNT0lMTlVKS0tVSkJLS1kG X-HM-Tid: 0a8f5d73d560023ckunm0f263860417 X-HM-MType: 1 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Ngg6Fjo*FDc*EUo6Aj1JLj5J GggwC0JVSlVKTEpOSU5CQ0lIQ0xIVTMWGhIXVR8UFRwIEx4VHFUCGhUcOx4aCAIIDxoYEFUYFUVZ V1kSC1lBWUlKQ1VCT1VKSkNVQktZV1kIAVlBTE5JTjcG 在 2024/5/9 星期四 下午 8:21, Jonathan Cameron 写道: > On Thu, 9 May 2024 19:24:28 +0800 > Dongsheng Yang wrote: > .. >>> Yes. I think we are going to have to wait on architecture specific clarifications >>> before any software coherent use case can be guaranteed to work beyond the 3.1 ones >>> for temporal sharing (only one accessing host at a time) and read only sharing where >>> writes are dropped anyway so clean write back is irrelevant beyond some noise in >>> logs possibly (if they do get logged it is considered so rare we don't care!). >> >> Hi Jonathan, >> Allow me to discuss further. As described in CXL 3.1: >> ``` >> Software-managed coherency schemes are complicated by any host or device >> whose caching agents generate clean writebacks. A “No Clean Writebacks” >> capability bit is available for a host in the CXL System Description >> Structure (CSDS; see Section 9.18.1.6) or for a device in the DVSEC CXL >> Capability2 register (see Section 8.1.3.7). >> ``` >> >> If we check and find that the "No clean writeback" bit in both CSDS and >> DVSEC is set, can we then assume that software cache-coherency is >> feasible, as outlined below: >> >> (1) Both the writer and reader ensure cache flushes. Since there are no >> clean writebacks, there will be no background data writes. >> >> (2) The writer writes data to shared memory and then executes a cache >> flush. If we trust the "No clean writeback" bit, we can assume that the >> data in shared memory is coherent. >> >> (3) Before reading the data, the reader performs cache invalidation. >> Since there are no clean writebacks, this invalidation operation will >> not destroy the data written by the writer. Therefore, the data read by >> the reader should be the data written by the writer, and since the >> writer's cache is clean, it will not write data to shared memory during >> the reader's reading process. Additionally, data integrity can be ensured. >> >> The first step for CBD should depend on hardware cache coherence, which >> is clearer and more feasible. Here, I am just exploring the possibility >> of software cache coherence, not insisting on implementing software >> cache-coherency right away. :) > > Yes, if a platform sets that bit, you 'should' be fine. What exact flush > is needed is architecture specific however and the DMA related ones > may not be sufficient. I'd keep an eye open for arch doc update from the > various vendors. > > Also, the architecture that motivated that bit existing is a 'moderately > large' chip vendor so I'd go so far as to say adoption will be limited > unless they resolve that in a future implementation :) Great, I think we've had a good discussion and reached a consensus on this issue. The remaining aspect will depend on hardware updates. Thank you for the information, that helps a lot. Thanx > > Jonathan > >> >> Thanx >>> >>>>> >>>>>> >>>>>> CBD can initially support (3), and then transition to (1) when hardware >>>>>> supports cache-coherency. If there's sufficient market demand, we can >>>>>> also consider supporting (2). >>>>> I'd assume only (3) works. The others rely on assumptions I don't think >>>> >>>> I guess you mean (1), the hardware cache-coherency way, right? >>> >>> Indeed - oops! >>> Hardware coherency is the way to go, or a well defined and clearly document >>> description of how to play with the various host architectures. >>> >>> Jonathan >>> >>> >>>> >>>> :) >>>> Thanx >>>> >>>>> you can rely on. >>>>> >>>>> Fun fun fun, >>>>> >>>>> Jonathan >>>>> >>>>>> >>>>>> How does this approach sound? >>>>>> >>>>>> Thanx >>>>>>> >>>>>>> J >>>>>>> >>>>>>>> >>>>>>>> Keep in mind that I don't think anybody has cxl 3 devices or CPUs yet, and >>>>>>>> shared memory is not explicitly legal in cxl 2, so there are things a cpu >>>>>>>> could do (or not do) in a cxl 2 environment that are not illegal because >>>>>>>> they should not be observable in a no-shared-memory environment. >>>>>>>> >>>>>>>> CBD is interesting work, though for some of the reasons above I'm somewhat >>>>>>>> skeptical of shared memory as an IPC mechanism. >>>>>>>> >>>>>>>> Regards, >>>>>>>> John >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> . >>>>>>> >>>>> >>>>> . >>>>> >>> >>> >