mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anisa Su <anisa.su887@gmail.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Anisa Su <anisa.su887@gmail.com>,
	linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
	linux-kernel@vger.kernel.org, Dave Jiang <dave.jiang@intel.com>,
	Jonathan Cameron <jic23@kernel.org>, Fan Ni <nifan.cxl@gmail.com>,
	Li Ming <ming.li@zohomail.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Ira Weiny <iweiny@kernel.org>,
	Benjamin Cheatham <benjamin.cheatham@amd.com>,
	Wonjae Lee <wj28.lee@samsung.com>,
	Junhee Park <jh9934.park@samsung.com>,
	Heesoo Kim <habil.kim@samsung.com>,
	Dan Williams <djbw@kernel.org>
Subject: Re: [PATCH v12 5/8] cxl/pci: Factor out interrupt policy check
Date: Thu, 6 Aug 2026 05:27:42 -0700	[thread overview]
Message-ID: <anR9vpMtUVuPaTM4@AnisaLaptop.localdomain> (raw)
In-Reply-To: <anEqVU3-B3ab53eE@aschofie-mobl2.lan>

On Mon, Aug 03, 2026 at 04:55:01PM -0700, Alison Schofield wrote:
> On Fri, Jul 31, 2026 at 01:48:10AM -0700, Anisa Su wrote:
> > From: Ira Weiny <iweiny@kernel.org>
> > 
> > Dynamic Capacity Devices (DCD) require event interrupts to process
> > memory addition or removal.  BIOS may have control over non-DCD event
> > processing.  DCD interrupt configuration needs to be separate from
> > memory event interrupt configuration.
> > 
> > Factor out event interrupt setting validation.
> 
> Hi Anisa,
> 
> "Validation" seems like the wrong term here. The helper checks for
> firmware ownership of the memory event logs. It is not validating
> the event interrupt settings.
> 
Fixed. Commit message now reads

	Factor out the check for firmware ownership of the memory event logs.

> Which leads to my next comment -
> 
> snip
> > 
> >  
> > +static bool cxl_event_validate_mem_policy(struct cxl_memdev_state *mds,
> > +					  struct cxl_event_interrupt_policy *policy)
> > +{
> > +	if (cxl_event_int_is_fw(policy->info_settings) ||
> > +	    cxl_event_int_is_fw(policy->warn_settings) ||
> > +	    cxl_event_int_is_fw(policy->failure_settings) ||
> > +	    cxl_event_int_is_fw(policy->fatal_settings)) {
> > +		dev_err(mds->cxlds.dev,
> > +			"FW still in control of Event Logs despite _OSC settings\n");
> > +		return false;
> > +	}
> > +
> > +	return true;
> > +}
> 
> Why such a general name here? This helper seems to have one very specific purpose.
> 
> cxl_event_validate_mem_policy() doesn't validate the policy. It checks whether
> firmware still owns the standard memory event logs despite _OSC granting OS
> control. I'd prefer naming it after that condition rather than "validate".
> Something like cxl_event_fw_owns_mem_logs() reads much closer to what the
> code actually does.
> 
Renamed -- Naming it after the condition means the return value
has to invert, since true now means firmware does own them:

static bool cxl_event_fw_owns_mem_logs(struct cxl_event_interrupt_policy *policy)
	{
		return cxl_event_int_is_fw(policy->info_settings) ||
		       cxl_event_int_is_fw(policy->warn_settings) ||
		       cxl_event_int_is_fw(policy->failure_settings) ||
		       cxl_event_int_is_fw(policy->fatal_settings);
	}

so the caller loses its '!':

	if (cxl_event_fw_owns_mem_logs(&policy)) {
		dev_err(mds->cxlds.dev,
			"FW still in control of Event Logs despite _OSC settings\n");
		return -EBUSY;
	}

and I moved the dev_err out to the caller so
cxl_event_fw_owns_mem_logs() only answers the question "Does the FW own
event logs?"

Thanks,
Anisa

> --Alison
> 
> 
> > +
> >  static int cxl_event_config(struct pci_host_bridge *host_bridge,
> >  			    struct cxl_memdev_state *mds, bool irq_avail)
> >  {
> > @@ -661,14 +676,8 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge,
> >  	if (rc)
> >  		return rc;
> >  
> > -	if (cxl_event_int_is_fw(policy.info_settings) ||
> > -	    cxl_event_int_is_fw(policy.warn_settings) ||
> > -	    cxl_event_int_is_fw(policy.failure_settings) ||
> > -	    cxl_event_int_is_fw(policy.fatal_settings)) {
> > -		dev_err(mds->cxlds.dev,
> > -			"FW still in control of Event Logs despite _OSC settings\n");
> > +	if (!cxl_event_validate_mem_policy(mds, &policy))
> >  		return -EBUSY;
> > -	}
> >  
> >  	rc = cxl_event_config_msgnums(mds, &policy);
> >  	if (rc)
> > -- 
> > 2.43.0
> > 

  reply	other threads:[~2026-08-06 12:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  8:48 [PATCH v12 0/8] DCD Prep Series Anisa Su
2026-07-31  8:48 ` [PATCH v12 1/8] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD) Anisa Su
2026-08-03 18:03   ` Dave Jiang
2026-08-03 21:30   ` Alison Schofield
2026-08-03 23:12     ` Jonathan Cameron
2026-08-04 15:45       ` Gregory Price
2026-08-04 15:45   ` Gregory Price
2026-08-04 18:10     ` Anisa Su
2026-08-04 16:55   ` Alison Schofield
2026-08-04 18:13     ` Anisa Su
2026-07-31  8:48 ` [PATCH v12 2/8] cxl/mem: Read dynamic capacity configuration from the device Anisa Su
2026-08-03 14:33   ` Richard Cheng
2026-08-03 22:11     ` Anisa Su
2026-08-03 21:52   ` Alison Schofield
2026-08-04  9:12     ` Anisa Su
2026-08-04 16:00       ` Gregory Price
2026-08-21 18:55       ` Alison Schofield
2026-08-03 23:55   ` Jonathan Cameron
2026-08-04  9:54     ` Anisa Su
2026-07-31  8:48 ` [PATCH v12 3/8] cxl/cdat: Gather DSMAS data for DCD partitions Anisa Su
2026-08-03 22:56   ` Alison Schofield
2026-08-05  6:58     ` Anisa Su
2026-07-31  8:48 ` [PATCH v12 4/8] cxl/events: Split event msgnum configuration from irq setup Anisa Su
2026-08-03 23:01   ` Alison Schofield
2026-07-31  8:48 ` [PATCH v12 5/8] cxl/pci: Factor out interrupt policy check Anisa Su
2026-08-03 23:55   ` Alison Schofield
2026-08-06 12:27     ` Anisa Su [this message]
2026-07-31  8:48 ` [PATCH v12 6/8] cxl/mem: Configure dynamic capacity interrupts Anisa Su
2026-08-04  0:13   ` Jonathan Cameron
2026-08-04  0:34   ` Alison Schofield
2026-08-06 22:11     ` Anisa Su
2026-07-31  8:48 ` [PATCH v12 7/8] cxl/core: Return endpoint decoder information from region search Anisa Su
2026-08-04  1:02   ` Alison Schofield
2026-07-31  8:48 ` [PATCH v12 8/8] cxl/core: Enforce partition order/simplify partition calls Anisa Su
2026-08-04  0:16   ` Jonathan Cameron
2026-08-04  1:37   ` Alison Schofield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anR9vpMtUVuPaTM4@AnisaLaptop.localdomain \
    --to=anisa.su887@gmail.com \
    --cc=alison.schofield@intel.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=habil.kim@samsung.com \
    --cc=iweiny@kernel.org \
    --cc=jh9934.park@samsung.com \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=nifan.cxl@gmail.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    --cc=wj28.lee@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®