[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20171218190741.GB6424@roeck-us.net>
Date: Mon, 18 Dec 2017 11:07:41 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Zoltan Boszormenyi <zboszor@...hu>
Cc: linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-i2c@...r.kernel.org,
Paul Menzel <paulepanter@...rs.sourceforge.net>,
Christian Fetzer <fetzer.ch@...il.com>,
Jean Delvare <jdelvare@...e.com>,
Nehal Shah <nehal-bakulchandra.shah@....com>,
Tim Small <tim@...ss.co.uk>, kernel@...ss.net, wim@...ana.be,
jlayton@...chiereds.net, marc.2377@...il.com,
cshorler@...glemail.com, wsa@...-dreams.de,
regressions@...mhuis.info,
Alex Williamson <alex.williamson@...hat.com>, lyude@...hat.com,
Linus Torvalds <torvalds@...ux-foundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Toshi Kani <toshi.kani@....com>,
Jiang Liu <jiang.liu@...ux.intel.com>,
Jakub Sitnicki <jsitnicki@...il.com>,
Thierry Reding <treding@...dia.com>,
Vivek Goyal <vgoyal@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
Simon Guinot <simon.guinot@...uanux.org>,
Dan Williams <dan.j.williams@...el.com>,
Mike Travis <travis@....com>,
Daeseok Youn <daeseok.youn@...il.com>,
Huang Rui <ray.huang@....com>, Andiry Xu <andiry.xu@....com>,
Alan Cox <gnomes@...rguk.ukuu.org.uk>,
David Howells <dhowells@...hat.com>,
Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
Alexandre Desnoyers <alex@...c.com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Grygorii Strashko <grygorii.strashko@...com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Wan ZongShun <Vincent.Wan@....com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Lucas Stach <dev@...xeye.de>,
Denis Turischev <denis.turischev@...pulab.co.il>
Subject: Re: [PATCH 2/5 v3] Modify behaviour of request_*muxed_region()
On Mon, Dec 18, 2017 at 09:48:38AM +0100, Zoltan Boszormenyi wrote:
> From: Böszörményi Zoltán <zboszor@...hu>
>
> In order to make request_*muxed_region() behave more like
> mutex_lock(), a possible failure case needs to be eliminated.
> When drivers do not properly share the same I/O region, e.g.
> one is using request_region() and the other is using
> request_muxed_region(), the kernel didn't warn the user about it.
> This change modifies IORESOURCE_MUXED behaviour so it always
> goes to sleep waiting for the resuorce to be freed and the
resource
> inconsistent resource flag usage is logged with KERN_ERR.
>
> v2: Fixed checkpatch.pl warnings and extended the comment
> about request_declared_muxed_region.
>
> v3: Rebased for 4.15-rc4
>
> Signed-off-by: Zoltán Böszörményi <zboszor@...hu>
> ---
> kernel/resource.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 05db9c4e3992..0f26f887ac33 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1143,6 +1143,7 @@ resource_size_t resource_alignment(struct resource *res)
> *
> * request_declared_muxed_region creates a new shared busy region
> * described in an existing resource descriptor.
> + * It only returns if it succeeded.
> *
> * release_region releases a matching busy region.
> * The region is only freed if it was allocated.
> @@ -1209,7 +1210,10 @@ struct resource *__request_declared_region(struct resource *parent,
> continue;
> }
> }
> - if (conflict->flags & flags & IORESOURCE_MUXED) {
> + if (flags & IORESOURCE_MUXED) {
> + if (!(conflict->flags & IORESOURCE_MUXED))
> + pr_err("Resource conflict between muxed \"%s\" and non-muxed \"%s\" I/O regions!\n",
> + res->name, conflict->name);
With this, the muxed resource requestor will hang since the non-muxed
requestor will not release the resource. I understand that you are trying
to get rid of the error return, but is replacing it with a hang really
better ?
> add_wait_queue(&muxed_resource_wait, &wait);
> write_unlock(&resource_lock);
> set_current_state(TASK_UNINTERRUPTIBLE);
> --
> 2.13.6
>
Powered by blists - more mailing lists