Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp804284rwb; Wed, 16 Nov 2022 07:54:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf70XPl5f6/SccGs3omJRCwicHKkjK+h8ixEzemgPPTRb2Q8L/oAOGTbFuPKBl1balahUesB X-Received: by 2002:a05:6402:2294:b0:464:fa1:9dc3 with SMTP id cw20-20020a056402229400b004640fa19dc3mr20379919edb.343.1668614098063; Wed, 16 Nov 2022 07:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668614098; cv=none; d=google.com; s=arc-20160816; b=ljuprO9v9CN3faUaqdjObsiZmXMoez/UPce3diKYL/MtvjuIbb6DezBp6GoqLbSx5M AeO7Kse0312ItZZRzFaPPigYAcJFkdVB/rCeaMTBw4nJzgeh9Ht0h+9Zet1PR1Q0Z5IS yYGJLY/HBmQS0yASb5n5qXScNmv8rVPZ6f2FM18QaDZ+GS0cFLWjcVXGvz3X7LVe+CSz sPzW4jjYUdxqN1qg5huX51p+di4TiP/d/m5rkw4utYix0M683sdUFpuMWNQERVuMeiiJ eNt+c5b00luy/nYilu/j6z0kexgKtqyW9SAxPjnnbgk3kTPGa1KNj18sqZJMCA+7sXHn ZLKA== 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=SyPX0RosXy3mMiGFCbamijDWkjtyP2IVVSHtWusbfOw=; b=YqAvQilSabBg8ovVU/d9C9vpE1UlJoL/XACfKbvvOT3/74FqkuCs17nSCl3F3mIaHa yoxuL1aqS/T3m23fKzgYce4/tWVI6KS+fr7IxYYwNFCpPzl94Kw2Dk8bpN9jGMDmNz51 58EnfRGMNbac9rARcJ7LbDUp/R78ArcnPnSnhGELatQjUfdRkdXdCbqtwbQjstuMUxCY 9gE75LrmOP2N8PjPF7S+7BI691Dnoj0W5+y6AYG3I8L2AjeKezwELoZbmZHsXull0mXZ PjlwNn62U11LYGFDTctvncGWAj3hnQ099I1Waec9vAHU7T+EAp+SJCF0SJqKn5vhsac2 l2TQ== 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 o9-20020a50c909000000b0046107f9520csi12507341edh.210.2022.11.16.07.54.36; Wed, 16 Nov 2022 07:54:58 -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 S232836AbiKPPpw (ORCPT + 91 others); Wed, 16 Nov 2022 10:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiKPPpt (ORCPT ); Wed, 16 Nov 2022 10:45:49 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A2232613E; Wed, 16 Nov 2022 07:45:47 -0800 (PST) Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NC6hd0VM5z67KvJ; Wed, 16 Nov 2022 23:41:05 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 16 Nov 2022 16:45:44 +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.31; Wed, 16 Nov 2022 15:45:44 +0000 Date: Wed, 16 Nov 2022 15:45:43 +0000 From: Jonathan Cameron To: CC: Dan Williams , Alison Schofield , Vishal Verma , "Ben Widawsky" , Steven Rostedt , Davidlohr Bueso , , Subject: Re: [PATCH 03/11] cxl/mem: Implement Clear Event Records command Message-ID: <20221116154543.00003c6a@Huawei.com> In-Reply-To: <20221116152426.0000626b@Huawei.com> References: <20221110185758.879472-1-ira.weiny@intel.com> <20221110185758.879472-4-ira.weiny@intel.com> <20221116152426.0000626b@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: lhrpeml100001.china.huawei.com (7.191.160.183) 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 Wed, 16 Nov 2022 15:24:26 +0000 Jonathan Cameron wrote: > On Thu, 10 Nov 2022 10:57:50 -0800 > ira.weiny@intel.com wrote: > > > From: Ira Weiny > > > > CXL rev 3.0 section 8.2.9.2.3 defines the Clear Event Records mailbox > > command. After an event record is read it needs to be cleared from the > > event log. > > > > Implement cxl_clear_event_record() and call it for each record retrieved > > from the device. > > > > Each record is cleared individually. A clear all bit is specified but > > events could arrive between a get and the final clear all operation. > > Therefore each event is cleared specifically. > > > > Reviewed-by: Jonathan Cameron > > Signed-off-by: Ira Weiny > > > Some follow through comment updates needed from changes in earlier patches + > one comment you can ignore if you prefer to keep it as is. > > > static void cxl_mem_get_records_log(struct cxl_dev_state *cxlds, > > enum cxl_event_log_type type) > > { > > @@ -728,14 +750,23 @@ static void cxl_mem_get_records_log(struct cxl_dev_state *cxlds, > > } > > > > pl_nr = le16_to_cpu(payload.record_count); > > - if (trace_cxl_generic_event_enabled()) { > > To simplify this patch, maybe push this check down in the previous patch so this > one doesn't move code around? It'll look a tiny bit odd there of course.. > > > + if (pl_nr > 0) { > > u16 nr_rec = min_t(u16, pl_nr, CXL_GET_EVENT_NR_RECORDS); > > int i; > > > > - for (i = 0; i < nr_rec; i++) > > - trace_cxl_generic_event(dev_name(cxlds->dev), > > - type, > > - &payload.record[i]); > > + if (trace_cxl_generic_event_enabled()) { > > + for (i = 0; i < nr_rec; i++) > > + trace_cxl_generic_event(dev_name(cxlds->dev), > > + type, > > + &payload.record[i]); > > + } > > + > > + rc = cxl_clear_event_record(cxlds, type, &payload, nr_rec); > > + if (rc) { > > + dev_err(cxlds->dev, "Event log '%s': Failed to clear events : %d", > > + cxl_event_log_type_str(type), rc); > > + return; > > + } > > } > > > > > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h > > index da64ba0f156b..28a114c7cf69 100644 > > --- a/drivers/cxl/cxlmem.h > > +++ b/drivers/cxl/cxlmem.h > > > > > +/* > > + * Clear Event Records input payload > > + * CXL rev 3.0 section 8.2.9.2.3; Table 8-51 > > + * > > + * Space given for 1 record > > Nope... > > > > + */ > > +struct cxl_mbox_clear_event_payload { > > + u8 event_log; /* enum cxl_event_log_type */ > > + u8 clear_flags; > > + u8 nr_recs; /* 1 for this struct */ > Nope :) Delete the comments so they can't be wrong if this changes in future! Ah. You only use one. So should hard code that in the array size below. > > > + u8 reserved[3]; > > + __le16 handle[CXL_GET_EVENT_NR_RECORDS]; > > +}; > > + >