From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77B1C499F01 for ; Thu, 6 Aug 2026 22:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786054279; cv=none; b=qNNwZ5iXS9S8Gy9Bkom3eWt6wW/N2S3Q8FMsgeV/Dlyl6vc0GDqGn3EHRSFsfe55ZmbzbfKeHTcHSymgXQ4149ogfm4VRZDrnc8UtludcXNFaPYYqsPfZCtdzhJJkRnyCXbKazDdcjh+UrukCPBPAuWkxgeQ8GyU6plRoyn7d3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786054279; c=relaxed/simple; bh=vBSwfYpDDTgwd6+GO3iIxrzRGWg53xkqWYgOrms10+k=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AZ9zjwNrQoSA4CDwWa30XZ5yCWREc0y0UIIXpwRUzwOGZpxseSbMv+m2YrJFyq2a2H5RYJvAFUMlJLM/CUGNxjsPAs4wtoakotxGth2tU9BIdYNb6sYq3cA0zSH6cteE2nUiR+N4Gf3k4fU+bLkiHZutYE42TXJ/3Xa43lECOEU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gwEbyGLh; arc=none smtp.client-ip=209.85.214.170 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.b="gwEbyGLh" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2cea3004256so34712885ad.0 for ; Thu, 06 Aug 2026 15:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786054277; x=1786659077; darn=vger.kernel.org; h=in-reply-to: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=Taune2r+NXfjBAxg07RGJytisNNYjB7FbzdhiuVu+8c=; b=gwEbyGLhvDxx2sQ6gk6W3jd106IGtrhbucAOuzqfih4OLlHJmyjVdMF7JVQS5HI2hM zPg9RUcRPruza9+aAh1bW+CJsd2a54x9LYhbLTN2UBJb9jDKYnFIeEq0x+1V+GaTzxTl GuiQfYqhxAslL3K9CvSzYbTGM/akyrBCeRAnndNrT/SmH47gTIYjD3CHd++9qOrfg3Fq qiVb8hNPynnwNJBPeddlXcU7cEu8wZsLCG9oNWutOlRJsIE6QyryJD5PpPlh2CnBr+tw rIDJenLVFvN4KYhMQ0Zpz0DCPeNzdDAcOBLn6qL0CRvopH0uNOqAkd/KUyDdtcursv5n rKhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786054277; x=1786659077; h=in-reply-to: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=Taune2r+NXfjBAxg07RGJytisNNYjB7FbzdhiuVu+8c=; b=nFbNTMCXFerEduP9REcqOnqEd7CcBgwrLX1K+JaQeYsrXCVH1bVNlrUMIR45l7BOkc rUfO2LMntawTTwjKcwTuVt0u1l1zqJtX9bdcCC2225aseq5gi0KANt/4cr/FNpfVxMIL WbeUST4NkO9jmXuzdTzbqM195NYES/nsg2keAxmpw/g+xU7sLxLZ2wVYatzXY++ovhqQ +wQdqJDAokNznbUqCZOLsqrRVLQlNmzfsPNo5fdjuvUhtczCmyqG8+1amkMXEl7vO4gd q9s4eABgDUhWBaguU4iae9b0Y1ZhQhYpTTq2tng5gbzdzbKDLCzHiuJLbCkcnxSE3D5/ bxGw== X-Forwarded-Encrypted: i=1; AHgh+RpsT5DzmmOq9Wz7dS/7W4T23SHI90opuG92gNaAZy+wxt5imbIse161yi3oEuwoowoMSztpopWDHAClLQs=@vger.kernel.org X-Gm-Message-State: AOJu0YzfycDTOFxtwOvOt+YqncH6iv4ZQ9AEiP26P7zusKdw8anS9q0X wuSeVBMReKiDXoKFMvH74zoEVVgFM316E5LhETzxWHj6ODNetY55tSZx X-Gm-Gg: AR+sD10ICoKcrGXTRzChCZjFF2Lau92TxR5IFVMTD2tLDhkTUcrKLPNWWi0X42/w3Rd U+cjCgLK3mdxWHTYaKxDOBZolFRIxYbdd7Cm5UJnDeD5+nCmzC/UYxKINEJLBxx4la67RQQsP8D 7TcvGhkeejndgn6GiCC8I8JN1mVdFXzOHA28WWqNkGIjE3IPgK1C9StBWLPAfQzXIxllL/vOKYl zDdGSrofZ7rdPNWeodShtvoUP3a3OrsZAZkxIMhCK0joDsMfW8hAZCBOhEfs0ET3ggyQTlLc6E+ EMacPwQN4RDXwI7txaWZ4NzTMYpVHxf3WZ2TP73OdWbP6vLpFbgJpu4CKSc4pPYARL5j2q6z59M 4bJsClULVDDCGHtlxdvuNRuFTL8LQhi+JEL1dXn2X3n/ohVK7K1qGaDI7QhdbPuwCBBcCLaf7ty ihsYzH6+/klkbhnl/LqFqP309Ba45rV/bmOQOyu0V0DB/MKUWhMT2/zq53 X-Received: by 2002:a17:903:2288:b0:2c6:8d95:fd6d with SMTP id d9443c01a7336-2d0ca98f8a1mr179206395ad.21.1786054276584; Thu, 06 Aug 2026 15:11:16 -0700 (PDT) Received: from cxlqual ([220.120.90.131]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d14dbeaa95sm511055ad.38.2026.08.06.15.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 15:11:16 -0700 (PDT) From: Anisa Su X-Google-Original-From: Anisa Su Date: Fri, 7 Aug 2026 07:11:42 +0900 To: Alison Schofield Cc: Anisa Su , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, Dave Jiang , Jonathan Cameron , Fan Ni , Li Ming , Vishal Verma , Davidlohr Bueso , Ira Weiny , Benjamin Cheatham , Wonjae Lee , Junhee Park , Heesoo Kim Subject: Re: [PATCH v12 6/8] cxl/mem: Configure dynamic capacity interrupts Message-ID: References: <20260731084901.1512819-1-anisa.su@samsung.com> <20260731084901.1512819-7-anisa.su@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Aug 03, 2026 at 05:34:45PM -0700, Alison Schofield wrote: > On Fri, Jul 31, 2026 at 01:48:11AM -0700, Anisa Su wrote: > > From: Ira Weiny > > > > Dynamic Capacity Devices (DCD) support extent change notifications > > through the event log mechanism. The interrupt mailbox commands were > > extended in CXL 3.1 to support these notifications. Firmware can't > > configure DCD events to be FW controlled but can retain control of > > memory events. > > > > Configure DCD event log interrupts on devices supporting dynamic > > capacity. Disable DCD if interrupts are not supported. > > > > Care is taken to preserve the interrupt policy set by the FW if FW first > > has been selected by the BIOS. > > Hi Anisa, > > I gave one comment in response to a Sashiko comment, wrt 'drain'. > Another below- > > > > + > > + /* > > + * A CXL 3.0+ device can carry dcd_settings field without DCD command > > + * support, so size the request by the device's policy_size and only > > + * enable the DCD interrupt when DCD commands are supported. > > + */ > > + if (cxl_dcd_supported(mds)) > > + policy->dcd_settings = CXL_INT_MSI_MSIX; > > > > mbox_cmd = (struct cxl_mbox_cmd) { > > .opcode = CXL_MBOX_OP_SET_EVT_INT_POLICY, > > .payload_in = policy, > > - .size_in = sizeof(*policy), > > + .size_in = policy_size, > > }; > > Can you help me understand what happens if policy_size is only 4 bytes. > dcd_settings is never sent in the Set command. How do we know cxl_irqsetup() > isn't using a value the device never accepted? > Hmmm... good catch. If a non spec-compliant device reports support for all four 48h commands in the CEL but simultaneously reports a 4 byte policy_size, the device will never see policy->dcd_settings. Then the re-read at the end of cxl_event_config_msgnums() doesn't erase the value that was never really set on the device: /* Retrieve final interrupt settings */ return cxl_event_get_int_policy(mds, policy, NULL); ^ reads into the same struct, the device returns 4 bytes again, and byte 5 keeps the value the driver just wrote. So "final interrupt settings" is the driver's own value round-tripping back for that field, and cxl_irqsetup() arms the DCD interrupt from it. A spec-compliant device can't trigger this, since cxl_dcd_supported() requires all four 48h commands in the CEL, DCD is CXL 3.x, and a 3.x Get Event Interrupt Policy returns the 5 byte policy including dcd_settings. But to enforce it explicitly in the driver, added the check below in cxl_event_config(), before cxl_event_config_msgnums(): /* * dcd_settings cannot be sent to a device whose policy is too short * to hold it, so the device would never accept the setting * cxl_irqsetup() arms the DCD interrupt with. */ if (cxl_dcd_supported(mds) && policy_size < sizeof(policy)) { dev_warn(mds->cxlds.dev, "DCD supported but interrupt policy is only %zu bytes\n", policy_size); cxl_disable_dcd(mds); } Disabling DCD makes cxl_dcd_supported() false, so the Set stops setting dcd_settings and cxl_irqsetup() skips the DCD interrupt. Thanks, Anisa > > > rc = cxl_internal_send_cmd(cxl_mbox, &mbox_cmd); > > @@ -596,7 +635,7 @@ static int cxl_event_config_msgnums(struct cxl_memdev_state *mds, > > } > > > > /* Retrieve final interrupt settings */ > > - return cxl_event_get_int_policy(mds, policy); > > + return cxl_event_get_int_policy(mds, policy, NULL); > > } > > snip >