Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp538669imm; Fri, 21 Sep 2018 04:28:40 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdab3T/5mwdz4nA6wJnzCYHHYL70jWdrYCpaTCsnFZ6VjWPT94kzsLOIw8caI2JOCL0oiv+C X-Received: by 2002:a62:dbc5:: with SMTP id f188-v6mr46783086pfg.182.1537529320922; Fri, 21 Sep 2018 04:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537529320; cv=none; d=google.com; s=arc-20160816; b=Xem4KvkHrdegOc2XdgcTj6P7HNvGPF7ig7wdUJ/XHcCwAdTruxQfWquVFc9JWo2KL2 1ZqfB3KKcwgE7astmNTYkwM5XocwB8EVamf0ZaWeKqv8/UGz9uC5dKvxaptubbDGwZJ9 1Uyze3jH7VTaePMwtLGa08xowIdHbL1yjS4wHti+BoJHCs4rgioZIn0oRxYnYrOyKYoh rHXegLtXW/F9gO0rt8JdTEUx8VMtEoU/FOiffDGwmcSMl8bCL1Y6Gi66te6pjjC3H/Mt MqxIIp/NtHId3cb5HJYDOLZBYDF60Z0viRhICVJj0O4p9Lenf1jgl8ZtV6xRy8zLndgi jQ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=vw0e28fwSZC5UQc5BVCOLbGo+yoDvxKS5llDJY/qwuw=; b=OwhgW3R3XiAZ5Syu8BxU0zvxmFHUTkookE8akNki8OX8lewtokIaq51Z+sls5BAXEM eAK8U9BaOwP4kZ5xDb9RxfftrMBx5tEr1zni4hsIg2nlKDwWHPUiWCt4q2H0tjexKAZ8 nLmqeZ3vuAKlAfN8I8rRjF0DT+o2ZW5DLaXwCtcGCY9Ngv3d4b/koIIbwkey2Xjel3gA EVSZusfVI1X1BPqZkRzrFU9sFQQ4fiFiX9HPns5ehvLX07b68Pkf31qVHn0f2bTwqdfL ZMHTMB9C7p1EoaoKcY/1ELn31TVdFtjG1+P2Kl22rdsnnTgQyPCZHpgk3RvsEcSYc1Ef lvow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ROigMOcF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si5496015pgi.473.2018.09.21.04.28.23; Fri, 21 Sep 2018 04:28:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ROigMOcF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389960AbeIUROy (ORCPT + 99 others); Fri, 21 Sep 2018 13:14:54 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:37319 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389746AbeIUROx (ORCPT ); Fri, 21 Sep 2018 13:14:53 -0400 Received: by mail-oi0-f66.google.com with SMTP id p84-v6so11092335oic.4; Fri, 21 Sep 2018 04:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vw0e28fwSZC5UQc5BVCOLbGo+yoDvxKS5llDJY/qwuw=; b=ROigMOcFwVzgIKkSC+Aknm0Yax5z0Bt8xgKkCSE602kGi3Mg1H89oSwI9d46wRyeYb RmpEM1L+CX9xG7Y0cD3G8bjDAk9loiENARMpt4/cl+s4sbAF827q2sXS8B7MJHDoJ8+x 1ft5+Kurt9joBNo4X5ao8WPtyNq8V5hc/KNVkaSKBCOk605wL+3z84Ln7u7ZFSXum9yd ALQhTfBF67cVHE9rgJlEbV9vmFY74FCP546IxE4NqmVgsHt7MM9jUdJ8PT5Et484Hgmr ujH7or+JK3H7PFKL7j+KDnJXqKO0WywjaLTAx/QtCsDaW+M7ZwbYcgTxRE/qL8uYY89B iNTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vw0e28fwSZC5UQc5BVCOLbGo+yoDvxKS5llDJY/qwuw=; b=mXH1QZFLwT9vE7UUB2Ue3Cb9fcDZ6aJbWSQIYvbqqEf4TSAzfVRUxj22mNqPOpyCeI p0/KP7MgJyXdujbQIpFbfR5dE/gF+pn6PpcshxQuI5vcgMtY44i7rcwbhCwnywFVDIKt YwUc3yAJG8s1L/Z5GJZCAaCJamxFhqakXX/dNvdwf55JO+iNHgGRS/3Zg0i3IjEEPVKF GdGZXmJ5YVD2H8r2zJq1Jb18MQz3DAw4T05PKe90+kDCwRym0epZj+Xuk91bBt6pQMDN yZABu+wk5FxIz4wR1DM+IWpSmlB/N3kLQibTCguDpRzcHdKkTFkSlS9QxYXgw1nId7Xt UetA== X-Gm-Message-State: APzg51D0Wr9JwLmW4dzmqYIyu753a9JeQWD/vA8teFYE/uDFZCrR7T1D 1eA8F/82I3R22g/DWiDvrK/lBM6DXmi1EZnzlWM= X-Received: by 2002:aca:2203:: with SMTP id b3-v6mr1358004oic.366.1537529186279; Fri, 21 Sep 2018 04:26:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:326:0:0:0:0:0 with HTTP; Fri, 21 Sep 2018 04:26:25 -0700 (PDT) In-Reply-To: References: <20180831225616.29221-1-jmkrzyszt@gmail.com> <20180920101151eucas1p221f5a1715b8556bb9d99bf08fe09ce6f~WE-_cEf4l0754207542eucas1p27@eucas1p2.samsung.com> <9860023.SlBYqtbjDV@z50> <15226900.TQMLYV7PZ0@z50> <20180921081806eucas1p182d4646e8510b5f0356214af7edba11e~WXF8Ptw4M0970709707eucas1p1p@eucas1p1.samsung.com> From: Janusz Krzysztofik Date: Fri, 21 Sep 2018 13:26:25 +0200 Message-ID: Subject: Re: [PATCH v7 4/4] gpiolib: Implement fast processing path in get/set array To: Marek Szyprowski Cc: Linus Walleij , Jonathan Corbet , Miguel Ojeda Sandonis , Peter Korsgaard , Peter Rosin , Ulf Hansson , Andrew Lunn , Florian Fainelli , "David S. Miller" , Dominik Brodowski , Greg Kroah-Hartman , Kishon Vijay Abraham I , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Jiri Slaby , Willy Tarreau , Geert Uytterhoeven , linux-doc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-serial@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Linux Samsung SOC , Krzysztof Kozlowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, 2018-09-21 12:51 GMT+02:00, Janusz Krzysztofik : > Hi Marek, > > 2018-09-21 10:18 GMT+02:00, Marek Szyprowski : >> Hi Janusz, >> >> On 2018-09-20 18:21, Janusz Krzysztofik wrote: >>> On Thursday, September 20, 2018 5:48:22 PM CEST Janusz Krzysztofik >>> wrote: >>>> On Thursday, September 20, 2018 12:11:48 PM CEST Marek Szyprowski >>>> wrote: >>>>> On 2018-09-02 14:01, Janusz Krzysztofik wrote: >>>>>> Certain GPIO descriptor arrays returned by gpio_get_array() may >>>>>> contain >>>>>> information on direct mapping of array members to pins of a single >>>>>> GPIO >>>>>> chip in hardware order. In such cases, bitmaps of values can be >>>>>> passed >>>>>> directly from/to the chip's .get/set_multiple() callbacks without >>>>>> wasting time on iterations. >>>>>> >>>>>> Add respective code to gpiod_get/set_array_bitmap_complex() >>>>>> functions. >>>>>> Pins not applicable for fast path are processed as before, skipping >>>>>> over the 'fast' ones. >>>>>> >>>>>> Cc: Jonathan Corbet >>>>>> Signed-off-by: Janusz Krzysztofik >>>>> I've just noticed that this patch landed in today's linux-next. Sadly >>>>> it >>>>> breaks booting of Exynos5250-based Samsung Snow Chromebook (ARM 32bit, >>>>> device-tree source arch/arm/boot/dts/exynos5250-snow.dts). >>>>> >>>>> Booting hangs after detecting MMC cards. Reverting this patch fixes >>>>> the >>>>> boot. I will try later to add some debugs and investigate it further >>>>> what >>>>> really happens when booting hangs. >>>> Hi Marek, >>>> >>>> Thanks for reporting. Could you please try the following fix? >>> Hi again, >>> >>> I realized the patch was not correct, j, not i, should be updated in >>> second >>> hunk. Please try the following one. >>> >>> Thanks, >>> Janusz >>> >>> >From a919c504850f6cb40e8e81267a3a37537f7c4fd4 Mon Sep 17 00:00:00 2001 >>> From: Janusz Krzysztofik >>> Date: Thu, 20 Sep 2018 17:37:21 +0200 >>> Subject: [PATCH] gpiolib: Fix bitmap index not updated >>> While skipping fast path bits, bitmap index is not updated with next >>> found zero bit position. Fix it. >>> >>> Signed-off-by: Janusz Krzysztofik >> >> This one also doesn't help. A quick compare of logs with this version and >> a working system shows, that with your patch (and fix) there are no calls >> to >> gpx0-2 pin (which are a part of mmc pwrseq), what causes mmc failure. If >> you need any more information (what kind of logs will help?), let me >> know. One more question. You said before that booting hanged after detecting MMC cards. Without the fix, I could imagine it keeps iterating with index not updated and simply never returns from gpiod_get/set_array_bitmap_complex(). Is the behaviour you observe the same with the fix applied? Thanks, Janusz > There is a debug message on array_info content available at the end of > gpiod_get_array(), could you please activate it and post the message so > we can understand better what is going on? > > On the other hand, I've had a look your device-tree configuration and > it looks like that specific setup won't benefit from the fast bitmap path. > You have pin 2 at position 0 and pin 1 at position 1 of the array. > Hence, the fast bitmap path covers only pin 1, and pin 2 is processed > by the old path with apparently buggy code for skipping over fast pins. > > As a temporary workaround, you could try to revert the order of pins in > your dts file (pin 1 at position 0, pin 2 at 1) and the mmc pwrseq code > should work for you again by taking the original old path, not skipping > over fast pins. Results of such check may also help us to better > understand and resolve the issue. > > Thanks, > Janusz > >> >>> --- >>> drivers/gpio/gpiolib.c | 7 ++++--- >>> 1 file changed, 4 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c >>> index a53d17745d21..369bdd358fcc 100644 >>> --- a/drivers/gpio/gpiolib.c >>> +++ b/drivers/gpio/gpiolib.c >>> @@ -2880,7 +2880,7 @@ int gpiod_get_array_value_complex(bool raw, bool >>> can_sleep, >>> __set_bit(hwgpio, mask); >>> >>> if (array_info) >>> - find_next_zero_bit(array_info->get_mask, >>> + i = find_next_zero_bit(array_info->get_mask, >>> array_size, i); >>> else >>> i++; >>> @@ -2905,7 +2905,8 @@ int gpiod_get_array_value_complex(bool raw, bool >>> can_sleep, >>> trace_gpio_value(desc_to_gpio(desc), 1, value); >>> >>> if (array_info) >>> - find_next_zero_bit(array_info->get_mask, i, j); >>> + j = find_next_zero_bit(array_info->get_mask, i, >>> + j); >>> else >>> j++; >>> } >>> @@ -3192,7 +3193,7 @@ int gpiod_set_array_value_complex(bool raw, bool >>> can_sleep, >>> } >>> >>> if (array_info) >>> - find_next_zero_bit(array_info->set_mask, >>> + i = find_next_zero_bit(array_info->set_mask, >>> array_size, i); >>> else >>> i++; >> >> Best regards >> -- >> Marek Szyprowski, PhD >> Samsung R&D Institute Poland >> >> >