Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2428343rwb; Wed, 30 Nov 2022 06:33:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf5zH4ydhXGCY6sbbM7jrs9r7WZ3qf8ylD06L9MpCWBdMH5AFdUxkz22YYTlzvEMKYOxh3Nx X-Received: by 2002:a17:902:b20c:b0:189:1318:714 with SMTP id t12-20020a170902b20c00b0018913180714mr53874238plr.122.1669818829272; Wed, 30 Nov 2022 06:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669818829; cv=none; d=google.com; s=arc-20160816; b=einPS7Lp4FMt6ifPXEhpACrEU7czZZI2BZD2tJmHJleGbya0Z1QLLO9bnP+uyFUzW3 dkhhuyP8INRl6ePgc+YW0rJjc8Oxx2UAb1umX0FI2zZe1gYNkC5osk21pS2z+7CrP9Q/ 1ZJJOIpQ0+4xqlGNFVFWJgumXf/OD7+patdCglYU3zmRsMXJoPytJ3R8uz7f2AfwcIen zcWyW7MnkW9nAkSOJR4EeXZMppXd//Jqi+au1ZDnsEnaFTkaK7qVqJYa7YeYUscZWc/c z6zQ/w6BpwWCvhSVLZY/BsF+qqQder3VDgWamZYsTO7Wsu/lLH/Q+8jkwKm4wkHTsmYx WM8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=tQOW50RqAk4bxEf0xE+UcSvKhc2RgbutJ6WxDJkDQjY=; b=dKygobo7q0umB3O3U0qTjKl+of6Dp9ikrCgbn6JhJGVULimVl9tpwNATvjyCRlLzWx jJHCgCAaMDhZa4VjdLY6Jo6fea1l+cA9FbNkjenaUwj99qs2Fg7AK89bXi8Q7YxGYtbf a2LlupgR2qgS2ly12dB+/9BCWs8e/5mZpwpV33SVOTvxGUJU1Ln2Mc2mYuHu6A24aYDN w5YjVMBNphesCLspoOfAqK0/lvimdmQ2F8UgynXkgOahplh/BOtV3atKNKpaQqts5AC0 gcXkG10JvJLrwKHmqcspax8Pkc/PE8XVqyIEq5ZAH1a0jY3nEqvB3EIzEOW2P0a54+vJ r14A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a190-20020a6390c7000000b00478687fc16bsi476144pge.96.2022.11.30.06.33.34; Wed, 30 Nov 2022 06:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiK3OFl (ORCPT + 83 others); Wed, 30 Nov 2022 09:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbiK3OFg (ORCPT ); Wed, 30 Nov 2022 09:05:36 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AE623E0BF; Wed, 30 Nov 2022 06:05:32 -0800 (PST) Received: from frapeml100006.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NMgvP1hsxz686wm; Wed, 30 Nov 2022 22:05:05 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by frapeml100006.china.huawei.com (7.182.85.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 30 Nov 2022 15:05:29 +0100 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.2375.34; Wed, 30 Nov 2022 14:05:28 +0000 Date: Wed, 30 Nov 2022 14:05:27 +0000 From: Jonathan Cameron To: Ira Weiny CC: Dan Williams , Steven Rostedt , Alison Schofield , "Vishal Verma" , Ben Widawsky , Davidlohr Bueso , , Subject: Re: [PATCH 02/11] cxl/mem: Implement Get Event Records command Message-ID: <20221130140527.00006778@Huawei.com> In-Reply-To: References: <20221110185758.879472-1-ira.weiny@intel.com> <20221110185758.879472-3-ira.weiny@intel.com> <20221116151936.0000662f@Huawei.com> <20221117104337.00001a3f@Huawei.com> <20221121104714.00003bab@Huawei.com> <20221129122620.00002cf0@Huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) 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_H2,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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Nov 2022 21:09:58 -0800 Ira Weiny wrote: > On Tue, Nov 29, 2022 at 12:26:20PM +0000, Jonathan Cameron wrote: > > On Mon, 28 Nov 2022 15:30:12 -0800 > > Ira Weiny wrote: > > > > [snip] > > > > > A valid reading of that temporal order comment is actually the other way around > > > > that the device must not reset it's idea of temporal order until all records > > > > have been read (reading 3 twice is not in temporal order - imagine we had > > > > read 5 each time and it becomes more obvious as the read order becomes > > > > 0,1,2,3,4,3,4,5,6,7 etc which is clearly not in temporal order by any normal > > > > reading of the term. > > > > > > Well I guess. My reading was that it must return the first element temporally > > > within the list at the time of the Get operation. > > > > > > So in this example since 3 is still in the list it must return it first. Each > > > read is considered atomic from the others. Yes as long as 0 is in the queue it > > > will be returned. > > > > > > But I can see it your way too... > > > > That pesky text under More Event Records flag doesn't mention clearing when it > > says "The host should continue to retrieve > > records using this command, until this indicator is no longer set by the > > device." > > > > I wish it did :( > > > > As I have reviewed these in my head again I have come to the conclusion that > the More Event Records flags is useless. Let me explain: > > The Clear all Records flag is useless because if an event which occurs between the > Get and Clear all operation will be dropped without the host having seen it. Can still be used to get a known clean sheet if you don't care about a bunch of records on initial boot because no data in flight yet etc. Agreed it is no use if you care about content of the records. Make sure interrupts are enabled before re-checking if there are new records to close that race. > > However, while clearing records based on the handles read, additional events > could come in. Because of the way the interrupts are specified the host can't > be sure that those new events will cause a zero to non-zero transition. This > is because there is no way to guarantee all the events were cleared at the > moment the events came in. > > I believe this is what you mentioned in another email about needing an 'extra > read' at the end to ensure there was nothing more to be read. But based on > that logic the only thing that matters is the Get Event.Record > Count. If it is not 0 keep on reading because while the host is clearing the > records another event could come in. > > In other words, the only way to be sure that all records are seen is to do a > Get and see the number of records equal to 0. Thus any further events will > trigger an interrupt and we can safely exit the loop. Agreed - standard race to close when ever we have a FIFO with edge interrupts on how full it is. More records is useful for a different potential pattern of non destructive read and later clear. Or for a debug non destructive read. int nr_rec; round_we_go: do { ... ... ... } while (!MORE); for_each_list_entry() { clear records one at a time. } nr_rec = le16_to_cpu(payload->record_count); if (nr_rec) goto round_we_go; ... > > Ira > > Basically the loop looks like: > > int nr_rec; > > do { > ... ... > > nr_rec = le16_to_cpu(payload->record_count); > > ... ... > ... ... > > } while (nr_rec); >