From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796331915; b=LXB1eJTv3N2Y3bUba6vYif9rvdvKYz3kiI81JZ4HoeYnoU4U+0AhLnF33pV+BuKyz+jU k/g5M0t/d5nX7A1Bg9jsP4hnn1mk0k3TKQuFCbc1bsOFsbQJU7MYVgBXd5SD0mzuRAauQ gXu/3yIoyg/52zsFCN5+vpaQ9CW8ySFnjw3j7+M5j9Y4LIrRcIxqwAszHhZCfd5cJ0tXD apxe4eYefuZnjokAlWielI3+xrF4bD3xioVwcN2rmgnNZePk1ECnqu1XJXqbmz+sW7F4V KKmqBuwxEp0OlFK1HSu6xEICRlrPz59v6c1WuQtiC3m6V+civ6uoQBp5ui4/iuKYbpw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796331915; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:X-Google-Original-From:Date:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=5EdS1l8BlEqmR9X9YocggHe0V/2j4Mmf/ZoGXEANNhs=; b=Y1LDBm3yspKdHkVF+F7v9oOy7Dt4XdzlmZtF+n8R/P7ZHhCEDa+4B8zCEyfY3SCmiaqN 7tSTmqGMUto5/SaIab98Sww2j+nwz+0LP69BvqW6ZhEgx0fhXIVqJ+oggaHw+liCgDWxg c2Ruium8uFZ7BQpICDlMWd7AwUCpORia4J0IsxPDM+YotMQEohQdOsLvSVLPYxSx55xHH pcjRxt9iIZaGymBs4npRw5FqEFBtzMNK7+P/8CwlCMvceu3SKOW61nd+9chzQPK3e2W3d 0oALxp6dpzesaF4VY6CeaSfCdR60uLhtN6CRxiFl60egi7BdnTvF9zL5T0TpTWsha6A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=T2SuWp65; arc=none smtp.remote-ip=209.85.216.41 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B77A4606A32C for ; Thu, 3 Dec 2026 21:05:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B77A4606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=T2SuWp65 Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-3b09a83d12aso181924a91.2 for ; Thu, 03 Dec 2026 13:05:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796331914; x=1796936714; darn=lists.linux.dev; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:date :from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=5EdS1l8BlEqmR9X9YocggHe0V/2j4Mmf/ZoGXEANNhs=; b=T2SuWp653ovI8oqC2DBYW9HDr9aQrgFwOzyVpovRfh27Yl6r33ugNSYUTLtSl7Dh9m MXK7qOuJZ7h+MtGFdaS/cDGS3Sjtq8FuXkmWky+r9DRre8iBkYSx66XkQCFo8E0H8Aae 5qS1YDrv+ktS4wPUDLE/36UkjZAQzNGc7oICcLDq7QEn1D5YD+tKngomm50QH045HmdE NNqDVRGIUxWV6P+HQvJs36lqxqyUvWCyqbLWfqekWMssMD7kcqgeijtIUdqJGMr1Ba5i SC0hez0hAXPCUT5Sje80YjEYEYejnU8DHtii8adg6kk+Cml84tlfQYd/IGcneema1e0E h0Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796331914; x=1796936714; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:date :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=5EdS1l8BlEqmR9X9YocggHe0V/2j4Mmf/ZoGXEANNhs=; b=F/uOYZbAILCHcd8oNOpxUJ+F6EQYUkcFK2xQJMowSY6TGQvleKj+8tJ7rPKh/0CQQP 7NDf5pRdzP/9xT9tHgsi4tgQaQDKIGcihqVRUsrJZKoACJI+Kq+9EqVobn92cYN4S54B PHUhvMsvadNinKJgOX0xp7tYat1fO1aca7VNocVsJcDviDMCkriDouNdDtMgz5hFc3wr KIAwvqlDZ/IHowk1ezIiETKxGHVgVfrUBf/+MzNscj2IexQoS7RZ0Mb9JdXQdLFYjB4M iDTeAooGV2wPy8OXe2+biz5Y+CuPV48iTzOTt8dr0ZVTjZIi/SlgzAz7uIhcO2+CqsGq owuA== X-Forwarded-Encrypted: i=1; AL+hErFC66raxFSPS3fvqj7vcJNy01VlYXt4VFE5Vk2EswN7bkIyqMg4g8U1eumkUX9mlE6h385tn8I=@lists.linux.dev X-Gm-Message-State: APuU4Z9RJdaRK52HebDeOLx4VGcLbe0I7fRzJXcfmsAQSFfyC/lnBMZe NBdgLlURLEWikNtuC8/ErZ5FBhmnKgh8Nk0Fc04HJ1xPUc29EKhHQ2Cy X-Gm-Gg: AZFdTZd+aUsn1iYc1enSWutLuApfVMnSEOJqMQeigtU+yH4l9IB8rYlr02R0aJ6ER0l 1Wvp5E9/1DYJnT68fH29WYWpuN/Xf6qyeO+wBDUOBx7PZO8+/Ar4Hn4qK/OCYja7MBx5TJcbURg yoTIfp2yZUYNMIgDr6QxFNh9Q0DVT1qBezp16RAe9rT9Hp6PPvUVPVP/wJdPASTlAhgrLAAGDlI Yf1OykTsoOi5e3WDNE/JUKpe1j7GRy5k7izLw1VFX6WqSn2pW7DmnLl2lPgkiuhCawewUfd5ucJ zuYTsjAcoMOxbGuS5C43jzRANKnaanmSp3/7zZL1OSRzBzVFuvM0YzFPzsX2Ca9a/lZ3HBNYCX6 m6Pxl/PU0055/QMNf1XdqpYe2t7ia6NPrtTO3hcJBu2DddY1DigDC2Eke/yyGRuoVDxvUPj1zPp FPFHEJWrec8Z4JYDJtsX04iULysyvX2fInGRKCZ387JTaZdYbXLk3HEIP5nKNLErxHA0tmz7Qjv sPCaT0FoXuZ3HiB3/Eri4jBdZ8dFBJ3tRMlAcTrRZMsy17Qjalf5hfhOl00ql4NKb6dJZ73Nmw2 aWxRUu6srHeFRh2NnCpi8jbxZw== X-Received: by 2002:a17:90b:3810:b0:3b0:9a13:c5d5 with SMTP id 98e67ed59e1d1-3b41c8fed56mr48424849a91.16.1796331913760; Thu, 03 Dec 2026 13:05:13 -0800 (PST) Received: from cxlqual ([220.120.90.131]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5ddc54cc1sm479609a91.12.2026.12.03.13.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 13:05:13 -0800 (PST) From: Anisa Su X-Google-Original-From: Anisa Su Date: Fri, 4 Dec 2026 06:07:07 +0900 To: sashiko-reviews@lists.linux.dev Cc: Anisa Su , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Subject: Re: [PATCH v1 03/14] cxl/region: Add dynamic DAX region support Message-ID: References: <20261104230445.66625-1-anisa.su@samsung.com> <20261104230445.66625-4-anisa.su@samsung.com> X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Nov 04, 2026 at 11:21:39PM +0000, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [Medium] cxl/region: missing cxled_dcd_enabled() check in cxl_region_attach() Fixed. See below. > -- > > commit fbb76db124dfcb143d519163ab21665f41cdcfa6 > Author: Ira Weiny > > cxl/region: Add dynamic DAX region support > > This commit introduces dynamic DAX region support for CXL dynamic capacity > devices (DCD), tracking shareable and read-only partition properties on > CXL_PARTMODE_DYNAMIC_RAM regions and creating DAX regions with > IORESOURCE_DAX_DCD and a zero-sized seed device. > > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > > index f4a9839c73d2e..fc9139ce358fe 100644 > > --- a/drivers/cxl/core/region.c > > +++ b/drivers/cxl/core/region.c > > [ ... ] > > > @@ -2080,6 +2087,20 @@ static int cxl_region_attach(struct cxl_region *cxlr, > > return -EINVAL; > > } > > > > + /* A DC region's flavor is fixed; every member partition must match */ > > + if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM) { > > + struct cxl_dpa_partition *part = &cxlds->part[cxled->part]; > > + > > + if (part->shareable != cxlr->shareable || > > + part->read_only != cxlr->read_only) { > > + dev_dbg(&cxlr->dev, "%s: partition is %s, region is %s\n", > > + dev_name(&cxled->cxld.dev), > > + cxl_dc_mode_name(part->shareable, part->read_only), > > + cxl_dc_mode_name(cxlr->shareable, cxlr->read_only)); > > + return -EINVAL; > > + } > > + } > > + > > /* all full of members, or interleave config not established? */ > > if (p->state > CXL_CONFIG_INTERLEAVE_ACTIVE) { > > dev_dbg(&cxlr->dev, "region already active\n"); > > @@ -2411,6 +2432,7 @@ static size_t store_targetN(struct cxl_region *cxlr, const char *buf, int pos, > > if (sysfs_streq(buf, "\n")) > > rc = detach_target(cxlr, pos); > > else { > > + struct cxl_endpoint_decoder *cxled; > > struct device *dev; > > > > dev = bus_find_device_by_name(&cxl_bus_type, NULL, buf); > > @@ -2422,8 +2444,14 @@ static size_t store_targetN(struct cxl_region *cxlr, const char *buf, int pos, > > goto out; > > } > > > > - rc = attach_target(cxlr, to_cxl_endpoint_decoder(dev), pos, > > - TASK_INTERRUPTIBLE); > > + cxled = to_cxl_endpoint_decoder(dev); > > + if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM && > > + !cxled_dcd_enabled(cxled)) { > > + dev_dbg(dev, "DCD not enabled\n"); > > + rc = -ENXIO; > > + goto out; > > + } > > + rc = attach_target(cxlr, cxled, pos, TASK_INTERRUPTIBLE); > > out: > > put_device(dev); > > } > > [Severity: Medium] > Should the cxled_dcd_enabled(cxled) check live inside the > cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM block in cxl_region_attach() instead of > store_targetN()? > Yes, although not a reachable issue today because interleave is unsupported on DC regions, so each region can only have 1 endpoint decoder. construct_region() checks cxled_dcd_enabled(), preventing firmware committed decoders to be attached when dcd is disabled. However, that only works while DC regions are not interleaved. So for v2, the cxled_dcd_enabled() check is moved to cxl_region_attach(). The check in construct_region() remains, even though it eventually calls cxl_region_attach(), so we refuse before creating a region if dcd is disabled. - Anisa > In the auto-discovery path, cxl_add_to_region() looks up an existing region > before calling construct_region(): > > drivers/cxl/core/region.c:cxl_add_to_region() { > ... > struct cxl_region *cxlr __free(put_cxl_region) = > cxl_find_region_by_range(cxlrd, &ctx.hpa_range); > if (!cxlr) > cxlr = construct_region(cxlrd, &ctx); > > rc = PTR_ERR_OR_ZERO(cxlr); > if (rc) > return rc; > > attach_target(cxlr, cxled, -1, TASK_UNINTERRUPTIBLE); > ... > } > > When cxl_find_region_by_range() returns an existing region, construct_region() > is skipped and cxl_add_to_region() calls > attach_target() -> __attach_target() -> cxl_region_attach() directly. > > For example, if an auto-discovered DC region has its endpoint detached (where > __cxl_decoder_detach() lowers p->state to CXL_CONFIG_INTERLEAVE_ACTIVE while > leaving cxlr registered under cxlrd) and DCD is not enabled when the endpoint > port rebinds, or if a second endpoint with DCD disabled matches a region > created by an earlier endpoint during multi-way auto-discovery, > cxl_add_to_region() will find the existing cxlr and attach and commit cxled > without checking cxled_dcd_enabled(cxled). > > Checking !cxled_dcd_enabled(cxled) in cxl_region_attach() (alongside > construct_region()) would cover all target attachment paths under > cxl_rwsem.region and cxl_rwsem.dpa and avoid duplicating the check in > store_targetN(). > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/20261104230445.66625-1-anisa.su@samsung.com?part=3