Linux CXL
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	linux-cxl@vger.kernel.org, Jonathan.Cameron@huawei.com,
	dave@stgolabs.net, alison.schofield@intel.com,
	vishal.l.verma@intel.com
Subject: Re: [PATCH] cxl: Add cxl_region_rwsem around commit_end write during decoder enumeration
Date: Wed, 15 Nov 2023 14:06:24 +0100	[thread overview]
Message-ID: <20231115130624.GK4779@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20231115130113.GG3818@noisy.programming.kicks-ass.net>

On Wed, Nov 15, 2023 at 02:01:14PM +0100, Peter Zijlstra wrote:
> On Fri, Nov 10, 2023 at 12:21:56PM -0800, Dan Williams wrote:
> 
> >         /* decoders are enabled if committed */
> > -       if (committed) {
> > +       if (committed) scoped_guard(rwsem_write, &cxl_region_rwsem) {
> >                 cxld->flags |= CXL_DECODER_F_ENABLE;
> >                 if (ctrl & CXL_HDM_DECODER0_CTRL_LOCK)
> >                         cxld->flags |= CXL_DECODER_F_LOCK;
> > 
> > 
> > The alternative is a much more violent re-ident of the code to turn:
> > 
> >     if (...) scoped_guard(...) {
> > 	...
> >     } else {
> >         ...
> >     }
> > 
> > ...into:
> > 
> >     if (...) {
> >         scoped_guard(...) {
> > 	    ...
> >         }
> >     } else {
> >         ...
> >     }
> > 
> 
> What's wrong with:
> 
> 	if (...) {
> 		guard(rwsem_write, &cxl_region_rwsem);

Uh, that is:
		guard(rwsem_write)(&ctl_region_rwsem);

> 		...
> 	} else {
> 		...
> 	}
> 
> ?


  reply	other threads:[~2023-11-15 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 22:05 [PATCH] cxl: Add cxl_region_rwsem around commit_end write during decoder enumeration Dave Jiang
2023-11-09 19:58 ` fan
2023-11-10 23:12   ` Dan Williams
2023-11-09 22:38 ` Ira Weiny
2023-11-10 20:21   ` Dan Williams
2023-11-15 13:01     ` Peter Zijlstra
2023-11-15 13:06       ` Peter Zijlstra [this message]
2023-11-15 16:01         ` Dan Williams
2023-11-15 19:43           ` Peter Zijlstra

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=20231115130624.GK4779@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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