Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1338466

Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region()

Path csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod
From Vincent Pelletier <plr.vincent@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region()
Date Fri, 19 Feb 2016 22:10:02 +0100
Message-ID <r40tk-2SE-13@gated-at.bofh.it> (permalink)
References <q6Vzj-7bi-13@gated-at.bofh.it> <q6VSG-7Nj-11@gated-at.bofh.it>
X-Original-To Simon Guinot <simon.guinot@sequanux.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=0xhkSjhOM4NEfeqIw87dSXqO6Lp0+NnEMNJggDjKzVU=; b=ylqYBsTtpc6pjNCe0IzWoCNm+oUjsEMaMk4+BAXWCT9+fGhamlb3K8piNDfwKh/SJR bOklvLKZ4mL+EWvx0/tskqmzedFJhDDAeAwnFWqTPPIA2uVjGajGiIoAogsYG/vVI5xH UnRuip1jUi7lobj2A6/gYaxwkHHApEvBLAF3mVa43ofRpiV9sG+nsTaDoqU+L081CvsT QYeAQhi3c+VAPVw8GrwRxRCyOBaBkxxLvudBjmpzFyi/91L/FrmsC/Kd/67iKIcnxdKB D8njpBNpFpgRaOSO8SdXe1tNWWO30hnU3crRMVBPBurHZLorcZWsKoLtD4hkNbvkdPdx Yh7A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=0xhkSjhOM4NEfeqIw87dSXqO6Lp0+NnEMNJggDjKzVU=; b=XMBxXT0Rv5fcfObMn1fS2WE6nvA6DgLf4q0jrnRpIbXLmBjx8Hi8d3laKH47xSVAtG PwjFDIGgP95ugHw91KMLJ+6jIFj4Kxn84rHSyadzIBF20PyTJ/PTruKNaGAX7NXprpUX S/IZRGs/orsnF6DQJZj5xAvIXDgT/evsK7aqvGy05CKDj/TiOVSQXa7VUQmsg62yDgST VyeC0EhfUhDxFtb5mLV3qP4tmRwWErGUpFnS4hzpc/o0YII0Jc7PM2YuY7UEcXlxazEs 91DJELDkRG9YuBODRDc2yBZwjJBCTGCXx0XYUF2N34q+rsK0R/3TGsxrCtOsV2CglPLS CDmA==
X-Gm-Message-State AG10YOQsOvfPkLCW70th6NKF1APrvZipTowsK4JFvEyMXnKt9C6R+eM/zqivMFKGX14+TQ==
X-Received by 10.28.9.71 with SMTP id 68mr11067465wmj.33.1455916071375; Fri, 19 Feb 2016 13:07:51 -0800 (PST)
X-Mailer Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-pc-linux-gnu)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 64
Organization linux.* mail to news gateway
X-Original-Cc Alan Cox <alan@linux.intel.com>, Jesse Barnes <jbarnes@virtuousgeek.org>, Giel van Schijndel <me@mortis.eu>, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Donnefort <vdonnefort@gmail.com>, Yoann Sculo <yoann@sculo.fr>
X-Original-Date Fri, 19 Feb 2016 22:10:56 +0100
X-Original-Message-ID <20160219221056.23487da2@x2>
X-Original-References <20150909220140.GD9892@kw.sim.vm.gnt> <1441836918-24159-1-git-send-email-simon.guinot@sequanux.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1338466

Show key headers only | View raw


Hello,

I finally got around to rebasing some patches, and realised that the
patch from Simon Guinot below still gets rebased over torvalds' v4.4 .

Any reason it was not applied ?
Or was the issue fixed in another, non-git-conflicting way ? (I see
nothing recent in git log kernel/resource.c)

I do not find a trace of a mail confirming that I tested it and that it
fixes the issue. So here goes:
Tested-by: Vincent Pelletier <plr.vincent@gmail.com>

Testing details: bug reproduced on 4.1, patch applied over 4.1 and bug
disappeared. After rebasing this patch (along with others) over 4.4,
bug does not reappear. I did not try to reproduce bug with 4.4, but if
preferred I can give it a go.

On Thu, 10 Sep 2015 00:15:18 +0200, Simon Guinot
<simon.guinot@sequanux.org> wrote:
> In __request_region, if a conflict with a BUSY and MUXED resource is
> detected, then the caller goes to sleep and waits for the resource to
> be released. A pointer on the conflicting resource is kept. At wake-up
> this pointer is used as a parent to retry to request the region. A first
> problem is that this pointer might well be invalid (if for example the
> conflicting resource have already been freed). An another problem is
> that the next call to __request_region() fails to detect a remaining
> conflict. The previously conflicting resource is passed as a parameter
> and __request_region() will look for a conflict among the children of
> this resource and not at the resource itself. It is likely to succeed
> anyway, even if there is still a conflict. Instead, the parent of the
> conflicting resource should be passed to __request_region().
> 
> As a fix attempt, this patch don't update the parent resource pointer in
> the case we have to wait for a muxed region right after.
> 
> Reported-by: Vincent Pelletier <plr.vincent@gmail.com>
> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
> Tested-by: Vincent Donnefort <vdonnefort@gmail.com>
> ---
>  kernel/resource.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/resource.c b/kernel/resource.c
> index fed052a1bc9f..b8c84804db6a 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1072,9 +1072,10 @@ struct resource * __request_region(struct resource *parent,
>  		if (!conflict)
>  			break;
>  		if (conflict != parent) {
> -			parent = conflict;
> -			if (!(conflict->flags & IORESOURCE_BUSY))
> +			if (!(conflict->flags & IORESOURCE_BUSY)) {
> +				parent = conflict;
>  				continue;
> +			}
>  		}
>  		if (conflict->flags & flags & IORESOURCE_MUXED) {
>  			add_wait_queue(&muxed_resource_wait, &wait);

Regards,
-- 
Vincent Pelletier

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] kernel/resource.c: fix muxed resource handling in  __request_region() Vincent Pelletier <plr.vincent@gmail.com> - 2016-02-19 22:10 +0100
  Re: [PATCH] kernel/resource.c: fix muxed resource handling in  __request_region() Jesse Barnes <jbarnes@virtuousgeek.org> - 2016-02-20 00:30 +0100
    Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region() Linus Torvalds <torvalds@linux-foundation.org> - 2016-02-20 18:20 +0100
      Re: [PATCH] kernel/resource.c: fix muxed resource handling in __request_region() Jesse Barnes <jbarnes@virtuousgeek.org> - 2016-02-20 23:30 +0100
        Re: [PATCH] kernel/resource.c: fix muxed resource handling in  __request_region() Alan Cox <alan@linux.intel.com> - 2016-02-22 15:00 +0100
          Re: [PATCH] kernel/resource.c: fix muxed resource handling in  __request_region() Jesse Barnes <jbarnes@virtuousgeek.org> - 2016-02-22 22:00 +0100

csiph-web