public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Zijun Hu <zijun_hu@icloud.com>,
	Dan Williams <dan.j.williams@intel.com>, <dave.jiang@intel.com>,
	<ira.weiny@intel.com>
Cc: <stable@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Alison Schofield <alison.schofield@intel.com>,
	<vishal.l.verma@intel.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 4/5] cxl/port: Fix use-after-free, permit out-of-order decoder shutdown
Date: Mon, 14 Oct 2024 17:10:50 -0700	[thread overview]
Message-ID: <670db30a1ea6f_3ee2294ac@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <4239bfd4-d5fe-4ac8-a087-9e1584765e61@icloud.com>

Zijun Hu wrote:
> On 2024/10/15 03:32, Dan Williams wrote:
> > Zijun Hu wrote:
> >> On 2024/10/13 06:16, Dan Williams wrote:
> >>> Zijun Hu wrote:
> >>> [..]
> >>>>>> it does NOT deserve, also does NOT need to introduce a new core driver
> >>>>>> API device_for_each_child_reverse_from(). existing
> >>>>>> device_for_each_child_reverse() can do what the _from() wants to do.
> >>>>>>
> 
> [snip]
> 
> >>> Introduce new superset calls with the additional parameter and then
> >>> rewrite the old routines to just have a simple wrapper that passes a
> >>> NULL @start parameter.
> >>>
> >>> Now, if Greg has the appetite to go touch all ~370 existing callers, so
> >>> be it, but introducing a superset-iterator-helper and a compat-wrapper
> >>> for legacy is the path I would take.
> >>>
> >>
> >> current kernel tree ONLY has 15 usages of
> >> device_for_each_child_reverse(), i would like to
> >> add an extra parameter @start as existing
> >> (class|driver)_for_each_device() and bus_for_each_(dev|drv)() do
> >> if it is required.
> > 
> > A new parameter to a new wrapper symbol sounds fine to me. Otherwise,
> > please do not go thrash all the call sites to pass an unused NULL @start
> > parameter. Just accept that device_for_each_* did not follow the
> > {class,driver,bus}_for_each_* example and instead introduce a new symbol
> > to wrap the new functionality that so far only has the single CXL user.
> > 
> 
> you maybe regard my idea as a alternative proposal if Greg dislike
> introducing a new core driver API. (^^)

If the proposal is to add an unwanted parameter to existing call sites
then yes, I would NAK that.

> > [..]
> >>> If I understand your question correctly you are asking how does
> >>> device_for_each_child_reverse_from() get used in
> >>> cxl_region_find_decoder() to enforce in-order allocation?
> >>>
> >>
> >> yes. your recommendation may help me understand it.
> >>
> 
> below simple solution should have same effect as your recommendation.
> also have below optimizations:
> 
> 1) it don't need new core API.
> 2) it is more efficient since it has minimal iterating.
> 
> i will submit it if you like it. (^^)

See the patch I just submitted, it does not handle the case of competing
allocations. The cxld->region check is not sufficient for determining
that the decoder is committed.

  reply	other threads:[~2024-10-15  0:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  5:33 [PATCH 0/5] cxl: Initialization and shutdown fixes Dan Williams
2024-10-11  5:34 ` [PATCH 1/5] cxl/port: Fix CXL port initialization order when the subsystem is built-in Dan Williams
2024-10-14 11:33   ` Jonathan Cameron
2024-10-11  5:34 ` [PATCH 2/5] cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices() Dan Williams
2024-10-11 12:27   ` Lk Sii
2024-10-11 17:52     ` Dan Williams
2024-10-15 16:36   ` Jonathan Cameron
2024-10-15 17:57     ` Dan Williams
2024-10-16 14:51       ` Jonathan Cameron
2024-10-23  0:33         ` Dan Williams
2024-10-11  5:34 ` [PATCH 3/5] cxl/acpi: Ensure ports ready at cxl_acpi_probe() return Dan Williams
2024-10-11  5:34 ` [PATCH 4/5] cxl/port: Fix use-after-free, permit out-of-order decoder shutdown Dan Williams
2024-10-11 11:50   ` Zijun Hu
2024-10-11 17:46     ` Dan Williams
2024-10-11 23:40       ` Zijun Hu
2024-10-12 17:56         ` Gregory Price
2024-10-12 22:16         ` Dan Williams
2024-10-14  1:29           ` Zijun Hu
2024-10-14 19:32             ` Dan Williams
2024-10-15  0:02               ` Zijun Hu
2024-10-15  0:10                 ` Dan Williams [this message]
2024-10-15 16:47   ` Jonathan Cameron
2024-10-23  0:31     ` Dan Williams
2024-10-11  5:34 ` [PATCH 5/5] cxl/test: Improve init-order fidelity relative to real-world systems Dan Williams
2024-10-11 11:21 ` [PATCH 0/5] cxl: Initialization and shutdown fixes Alejandro Lucero Palau
2024-10-11 17:38   ` Dan Williams
2024-10-12  6:30     ` Alejandro Lucero Palau
2024-10-12 21:57       ` Dan Williams
2024-10-14 15:13         ` Alejandro Lucero Palau
2024-10-14 22:24           ` Dan Williams
2024-10-15  8:45             ` Alejandro Lucero Palau
2024-10-15 16:37               ` Dan Williams
2024-10-16 14:41                 ` Alejandro Lucero Palau
2024-10-23  0:46                   ` Dan Williams

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=670db30a1ea6f_3ee2294ac@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=zijun_hu@icloud.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