From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C0CDC48BC3 for ; Tue, 20 Feb 2024 13:40:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DDE16B007B; Tue, 20 Feb 2024 08:40:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 88D596B007D; Tue, 20 Feb 2024 08:40:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 755F46B007E; Tue, 20 Feb 2024 08:40:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 657756B007B for ; Tue, 20 Feb 2024 08:40:04 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 362FDA06F6 for ; Tue, 20 Feb 2024 13:40:04 +0000 (UTC) X-FDA: 81812290728.27.19FD36C Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf04.hostedemail.com (Postfix) with ESMTP id A687D4001A for ; Tue, 20 Feb 2024 13:40:01 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708436402; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HckJUv0X5e4AserE02IjG9jjV8ngHrAS/BWj5eG6jWk=; b=KTds2ztlHQpvQ8KgfrcegktPcyElDkJmIH9fM5WVkZytdZnavSdd0ozi+ZT+c0O7YIPz68 Hv77HzYIANtbwFEAHN98gAYgT1a3XG3XnPEKjJh0N4Pj8uf8ZIYDMejiV/H2ogesTJE3uZ BYuUwNtOQmQwDrnD1Mz1nBxX0KPCyz4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708436402; a=rsa-sha256; cv=none; b=mMwcAeRLr4J5pF46iCixTLmw99lWZN0KTx8HoJ2VcatL6PSmts44EjxZQ3kToL7wmUutjV 075DYorWDdPxrtB4478jr+7Fv7Slx1MAns7kEKdu0BROpjNkio9I0v0MMMGB3XiieBbDjg 1pkQA5Ufs/7/Q2Ob/Ou3IbepvQhVWS0= Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4TfL5y4085z6K7MC; Tue, 20 Feb 2024 21:36:22 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 3C2E7140C72; Tue, 20 Feb 2024 21:39:57 +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.35; Tue, 20 Feb 2024 13:39:56 +0000 Date: Tue, 20 Feb 2024 13:39:55 +0000 From: Jonathan Cameron To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v6 08/12] cxl/memscrub: Register CXL device ECS with scrub configure driver Message-ID: <20240220133955.0000710b@Huawei.com> In-Reply-To: <20240215111455.1462-9-shiju.jose@huawei.com> References: <20240215111455.1462-1-shiju.jose@huawei.com> <20240215111455.1462-9-shiju.jose@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: lhrpeml500003.china.huawei.com (7.191.162.67) To lhrpeml500005.china.huawei.com (7.191.163.240) X-Rspamd-Queue-Id: A687D4001A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: fkc9hbqtjo6aoidiqwp6qioatbj1yhto X-HE-Tag: 1708436401-503667 X-HE-Meta: U2FsdGVkX19y432DzSQ0eSuCOB4l7RHUBMu8bre4EGN8qhysaFegrG+WKHkBYSFL09i5jWic4P1eLDVKANaVOjBzVG2WFYrmg0SiFLl80vUzIoO6NAhK9VZD3pCYD4ev3/JSrnJoq1MHrKsdjj6kl0cnZaNJhgCN5aHh8XgxIfh2KSZC8YU1gKXmNpEbMziDhVHImWZCfWZUrF0Qc1XSTk0OLfDkFlwsV724VOJMQYhGx/stzqxuqvg+FMSwxnNm9IBwzzYckbOTDUHFdF5HjMLUeR6UBfNgrHtQnHKY/dOKd35RBChTipQ2oJr3cZowneq4gqHo/OqsjvPHgLD8/HiXQuuIJWYUm+f/DMJAek9JsC/Smq8bNf6TH3ZVWDXSYoIs/OBnx4XnroKdYE7pJv3TEmguun1bhw9k5PptMRFLRCyBxGcOMinDMjGstVSs0hFqAoJioFj2JGFn8NKiBPr3VdZRC89ewcxFIzJixjgNlr2n67ZcMJpikrlbhl0wbVT1BQ0Wi4K5sX9Zrx3ZmgXOL4nFFOkjWRcbfzst4ttEK2dINGwUIsLEFyO7dOA+A7ldnPIq618LtWskBLZpNK1AXdq49RHQFP4G3YJEKs2Rs1nJkO7MPtsaw/4oJiymvFaFwOy3hPjR1lVtAUujM65zrpf3HFYHu+WLgxXi3V6ONfktUVw9Q7nqTYuQE+sdl+/5RTq5vMxGd9NOSKu+oJ0drJvKanAsUbBsLj1Z6Xoc3UnuK3CTqze23CymQ2JM+NuNep1JZCt9vOLCWRxGs54cOXZsmolLPSFF9MzH44Y8vVvsjg4gtN7SuYbo8E2MA2bkNY7yVu5KxrDx0LJ3yjM90zYYWrj2dRCwKefH5jKgd+1mQ8RNTfhujdSAByrx X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, 15 Feb 2024 19:14:50 +0800 wrote: > From: Shiju Jose > > Register with the scrub configure driver to expose the sysfs attributes > to the user for configuring the CXL memory device's ECS feature. > Add the static CXL ECS specific attributes to support configuring the > CXL memory device ECS feature. > > Signed-off-by: Shiju Jose The ABI in here needs documentation. My key takeaway is that it is very ECS specific. I think one of the big challenges of a common scrub control system is going to be trying to come up with some meaningful common ABI. > --- > drivers/cxl/core/memscrub.c | 253 +++++++++++++++++++++++++++++++++++- > 1 file changed, 250 insertions(+), 3 deletions(-) > > diff --git a/drivers/cxl/core/memscrub.c b/drivers/cxl/core/memscrub.c > index a1fb40f8307f..325084b22e7a 100644 > --- a/drivers/cxl/core/memscrub.c > +++ b/drivers/cxl/core/memscrub.c > @@ -464,6 +464,8 @@ EXPORT_SYMBOL_NS_GPL(cxl_mem_patrol_scrub_init, CXL); > #define CXL_MEMDEV_ECS_GET_FEAT_VERSION 0x01 > #define CXL_MEMDEV_ECS_SET_FEAT_VERSION 0x01 > > +#define CXL_DDR5_ECS "cxl_ecs" I would just put these name defines inline. > +enum cxl_mem_ecs_scrub_attributes { > + cxl_ecs_log_entry_type, > + cxl_ecs_log_entry_type_per_dram, > + cxl_ecs_log_entry_type_per_memory_media, > + cxl_ecs_mode, > + cxl_ecs_mode_counts_codewords, > + cxl_ecs_mode_counts_rows, > + cxl_ecs_reset, > + cxl_ecs_threshold, > + cxl_ecs_threshold_available, > + cxl_ecs_max_attrs, This is pretty much all custom ABI. Challenging to make it common with the main scrub and RASF controls, but I think we do need to see if we can come up with something that is at least vaguely consistent across different forms of scrub control. What the user cares about is how likely an error is to get past the scrubbing that is running (I think - RAS folk speak up if I have this wrong!) So how do we go from the ECS parameters to that sort of info? I think ECS is effectively scrubbing at a fixed rate (google suggests all ram every 24 hours). We are really controlling what info is reported rather than what scrub is carried out. Useful stuff to potentially control but different from the other cases. > +}; > + > int cxl_mem_ecs_init(struct cxl_memdev *cxlmd, int region_id) > { > + char scrub_name[CXL_MEMDEV_MAX_NAME_LENGTH]; > struct cxl_mbox_supp_feat_entry feat_entry; > struct cxl_ecs_context *cxl_ecs_ctx; > + struct device *cxl_scrub_dev; Make this more local as we don't need it out here? > int nmedia_frus; > int ret; > > @@ -755,6 +993,15 @@ int cxl_mem_ecs_init(struct cxl_memdev *cxlmd, int region_id) > cxl_ecs_ctx->get_feat_size = feat_entry.get_feat_size; > cxl_ecs_ctx->set_feat_size = feat_entry.set_feat_size; > cxl_ecs_ctx->region_id = region_id; > + > + snprintf(scrub_name, sizeof(scrub_name), "%s_%s_region%d", > + CXL_DDR5_ECS, dev_name(&cxlmd->dev), cxl_ecs_ctx->region_id); > + cxl_scrub_dev = devm_scrub_device_register(&cxlmd->dev, scrub_name, > + cxl_ecs_ctx, NULL, > + cxl_ecs_ctx->region_id, > + &cxl_mem_ecs_attr_group); > + if (IS_ERR(cxl_scrub_dev)) > + return PTR_ERR(cxl_scrub_dev); > } > > return 0;