mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@linaro.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Rob Herring <robherring2@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	Jakub Sitnicki <jsitnicki@gmail.com>,
	Mike Travis <travis@sgi.com>,
	Jiang Liu <jiang.liu@linux.intel.com>,
	Thierry Reding <treding@nvidia.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejun Heo <tj@kernel.org>, Cliff Wickman <cpw@sgi.com>
Subject: Re: [PATCH 1/2] kernel/resource: Add new flag IORESOURCE_SHARED
Date: Tue, 09 Jun 2015 12:13:20 +0100	[thread overview]
Message-ID: <20150609111320.F299FC40580@trevor.secretlab.ca> (raw)
In-Reply-To: <CAPybu_2-EZoMEkWR9BoRfzGBevxCp-sd+CiVK2DhRjLoy5Pfyg@mail.gmail.com>

On Mon, 8 Jun 2015 22:02:06 +0200
, Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
 wrote:
> Hello Grant
> 
> On Mon, Jun 8, 2015 at 8:23 PM, Grant Likely <grant.likely@linaro.org> wrote:
> > On Fri,  5 Jun 2015 12:51:17 +0200
> > , Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> >  wrote:
> >> Some device tree platforms have not defined correctly their memory
> >> resources (i.e. Overlapping or duplication of resources).
> >> To avoid this issue we have historically avoided to add their resources to
> >> the resource tree. This leads to code duplication and oops when trying to
> >> unload dynamically a device tree (feature introduced recently).
> >>
> >> This new flag tells the resource system that a resource can be shared by
> >> multiple owners, so we can support device trees with problems at the
> >> same time that we do not duplicate code or crash when unloading the
> >> device tree.
> >>
> >> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> >> ---
> >
> > I'm really not comfortable with this change. The resource tree code is
> > complicated enough as is. Adding this exception case quite probably adds
> > corner cases that aren't property dealt with. If two regions overlay,
> > and then request_region is called? Which region does it become a child
> > of? And that's just off the top of my head. I don't want to hack in
> > changes to the resource code for what is a corner case.
> 
> I see your concern, perhaps you could provide a testcase and we can
> find out if it fails or not. So far I have tested a device tree with
> two devices on the same memory region, each device managed by a
> driver.

Actually, you need to provide the test case. You need to show that
you've thought through all the implications and corner cases on the
resource code. This is a non-trivial change to the how the resource code
works, and you need to demonstrate that your really understand the
implications of what you are doing.

Start with the example I pointed out. When a driver does a
request_mem_region(), which resource does it end up being a parent of if
the regions overlap? Can you write a unittest that demonstrates the code
has the correct behaviour? Will a driver end up getting the wrong
device's resource structure as the parent? (hint: yes it will)

> I can load and unload the device tree perfectly.

Merely making it work for your use-case isn't the issue. It's whether or
not making this change will break the core behavour of the resource
code. 

g.

  reply	other threads:[~2015-06-09 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 10:51 Ricardo Ribalda Delgado
2015-06-05 10:51 ` [PATCH 2/2] of/platform: Mark all device tree resources as SHARED Ricardo Ribalda Delgado
2015-06-05 16:45   ` Rob Herring
2015-06-05 16:51     ` Ricardo Ribalda Delgado
2015-06-07 14:01       ` Grant Likely
2015-06-08 18:23 ` [PATCH 1/2] kernel/resource: Add new flag IORESOURCE_SHARED Grant Likely
2015-06-08 20:02   ` Ricardo Ribalda Delgado
2015-06-09 11:13     ` Grant Likely [this message]
2015-06-09 12:33       ` Ricardo Ribalda Delgado

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=20150609111320.F299FC40580@trevor.secretlab.ca \
    --to=grant.likely@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhelgaas@google.com \
    --cc=cpw@sgi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=jsitnicki@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ricardo.ribalda@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=robherring2@gmail.com \
    --cc=tj@kernel.org \
    --cc=travis@sgi.com \
    --cc=treding@nvidia.com \
    --cc=vgoyal@redhat.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®