Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2660660imm; Mon, 24 Sep 2018 08:00:35 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdaa76i4xqkwu59bVLyxyia/VGMeAX+t6mG2W1qhYkZ0DATtHdO8Afc0i8hHFE6zdYav1Rq8 X-Received: by 2002:aa7:8319:: with SMTP id t25-v6mr10767994pfm.81.1537801235409; Mon, 24 Sep 2018 08:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801235; cv=none; d=google.com; s=arc-20160816; b=o6JPsKQoGqwdoFAU8oE3GfGrtOmzqtmwWEnoHiaMQmn+8HyFtPsY1WF6B7cbZldVp0 L/pX5m3r8T+URNSmhAVk3hNknuKsNDi4sxd2Xuf/Q5mRH1c3yl2KH3b1n7sFTa1/mv13 17087fK/yFvrkNVXbIiy8y/4DgO23LHZ1aakWi50eu+RVOeIoaLixni4HcGTtbsn/GEW a6iCCtwhN2Uib2gQTv9a6WhIKCMNpWffs0h5nNidDeiAuiGN/GQWrdT6JuI6vX3Z44vv wSqC62e1/VwNb+Y78vfsYgoBp3mMDsORw23X1XJ5ElbzRbeKU8U3lGulwmZ3W7TBrFT2 TU0A== 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=4pJG+c8XlNf7twfB38HXibR4Kbp7wNQVu3EnYQJ9GS8=; b=oeJzbGVXwnjl3ktLc92T3opVAf3fMS4MVavJOnoeVbs2LNsx9cUqVmhZmR3SujJvqU SKOOPemNN3BlwgmVMgBjrKa1UAu/0fRV7UIitT3zuMwipHKnB3XrE4CghNei3YmmIj5w hMEAG2WNmdMcGILedxpT9z5gFy0jZb83h4sRtwp42D2e50bxl3Q5wyuHxBorcGAoOKRo cPJZxeaiLS99bXp9dltnqUS+8vPNF0rOXULQhVQEg9S2sHYLJu3OaasL6zKGSGzXHylX E61J7m3sY977Jxsc/aWp5NsIMnhHWMcn9LqsbAaqeSfw7YpZQecTybiw6lSryNQNM5Bf 5OFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l8XlGtaw; 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 m185-v6si7295705pgm.206.2018.09.24.08.00.19; Mon, 24 Sep 2018 08:00:35 -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=l8XlGtaw; 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 S1728767AbeIXUUk (ORCPT + 99 others); Mon, 24 Sep 2018 16:20:40 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:42100 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728241AbeIXUUj (ORCPT ); Mon, 24 Sep 2018 16:20:39 -0400 Received: by mail-ot1-f66.google.com with SMTP id h26-v6so19968758otl.9; Mon, 24 Sep 2018 07:18:17 -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=4pJG+c8XlNf7twfB38HXibR4Kbp7wNQVu3EnYQJ9GS8=; b=l8XlGtaw9leEalBysDL2VUcpypz2FkoTmkHiWmXCes9aSSQ65W0P3j7g5zuJP+T/Zo u4kR8YXt5zMhBdlVHLUPhP1oHT0zejEb7bzYS99AEF3L7W+O2mcf3Hv0+y+grfbUCkGS UCFmyffq9PbtgzLABcyMFNKFshKkZSlsW9tgy0hsw+6f79twIycbPDJCqHdthzADwR6c eQ1cwIK3HI+x9Il6OGkrTwh8eun2AELZJET5PmShaydcRbEdi/5TSJDWQ8vVeCSPRCB5 DxuymYgofC541XLnATI9Pb9ahQGpS7H6SZEfWh7TBU/UNmffFcUSATGcOSsqDWJdgOT3 u1Lw== 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=4pJG+c8XlNf7twfB38HXibR4Kbp7wNQVu3EnYQJ9GS8=; b=SRB/ezNWyGMmWqrQIm3rXJCc09X5b5J6hOFJzNEA93Trj+CruWCspLySotAeeq6i7n JlmLg6lFQftBDiZar2nZbVFKYHlJG2PedxwOS1xo2r4SwjAd0Qx3fOjedTSPse6SIT3Y uQwHItCD3h83dBK5HiwrUjyYMkb1q1k1y7lot/HJyIdlKFT7pqPAPChfXYcWHzTAue6v +mB8ZEK2SMEuGVcBMCIFLSDa0zBmaGegrh78iGF4poHzdy13Z/N4c+8mhDNk0FpGTwed DdG3hYcNcBum8d3s+ulgZPG2w8JCTXUdTvfLkVtxNqsb8ST1nb07lQkHp5Cfr83CU1D3 fmTw== X-Gm-Message-State: ABuFfohqkHWM7N00nVmLTu6wci3rVIxR5RQySn0APDo9NDwuR6NaKlaX BLIDkuBPftRTcUkoujFCl1XUGtFskJX7pHUZtrw= X-Received: by 2002:a9d:7519:: with SMTP id r25-v6mr7086134otk.73.1537798696670; Mon, 24 Sep 2018 07:18:16 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:326:0:0:0:0:0 with HTTP; Mon, 24 Sep 2018 07:18:15 -0700 (PDT) In-Reply-To: <20180924113859eucas1p160322f5844c771bc9c680d35de4877a3~XUxM0smXV0334103341eucas1p1s@eucas1p1.samsung.com> References: <2785169.v6aIfS3K2k@z50> <20180923235336.22148-1-jmkrzyszt@gmail.com> <20180924094339eucas1p282f2f7cb627c183fe87da044edb90fa5~XTMgQ4GFs1339913399eucas1p2N@eucas1p2.samsung.com> <20180924113859eucas1p160322f5844c771bc9c680d35de4877a3~XUxM0smXV0334103341eucas1p1s@eucas1p1.samsung.com> From: Janusz Krzysztofik Date: Mon, 24 Sep 2018 16:18:15 +0200 Message-ID: Subject: Re: [PATCH 0/2] gpiolib: Fix issues introduced by fast bitmap processing path 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 , Sebastien Bourdelin , Lukas Wunner , Rojhalat Ibrahim , Russell King , Tony Lindgren , Yegor Yefremov , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , 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, Krzysztof Kozlowski , Linux Samsung SOC 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-24 13:38 GMT+02:00, Marek Szyprowski : > Hi Janusz, > > On 2018-09-24 13:08, Janusz Krzysztofik wrote: >> 2018-09-24 11:43 GMT+02:00, Marek Szyprowski : >>> On 2018-09-24 01:53, Janusz Krzysztofik wrote: >>>> While investigating possible reasons of GPIO fast bitmap processing >>>> related boot hang on Samsung Snow Chromebook, reported by Marek >>>> Szyprowski (thanks!), I've discovered one coding bug, addressed by >>>> PATCH 1/2 of this series, and one potential regression introduced at >>>> design level of the solution, hopefully fixed by PATCH 2/2. See >>>> commit messages for details. >>>> >>>> Janusz Krzysztofik (2): >>>> gpiolib: Fix missing updates of bitmap index >>>> gpiolib: Fix array members of same chip processed separately >>>> >>>> The fixes should resolve the boot hang observed by Marek, however the >>>> second change excludes that particular case from fast bitmap processing >>>> and restores the old behaviour. >>> I confirm, that the above 2 patches fixes boot issue on Samsung Snow >>> Chromebook with next-20180920. >>> >>> Tested-by: Marek Szyprowski >>> >>>> Hence, it is possible still another >>>> issue which have had an influence on that boot hang exists in the code. >>>> In order to fully verify the fix, it would have to be tested on a >>>> platform where an array of GPIO descriptors is used which starts from >>>> at least two consecutive pins of one GPIO chip in hardware order, >>>> starting ftom 0, followed by one or more pins belonging to other >>>> chip(s). >>>> >>>> In order to verify if separate calls to .set() chip callback for each >>>> pin instead of one call to .set_multiple() is actually the reason of >>>> boot hang on Samsung Snow Chromebook, the affected driver - >>>> drivers/mmc/core/pwrseq_simple.c - would have to be temporarily >>>> modified for testing purposes so it calls gpiod_set_value() for each >>>> pin instead of gpiod_set_array_value() for all of them. If that would >>>> also result in boot hang, we could be sure the issue was really the >>>> one addressed by the second fix. Marek, could you please try to >>>> perform such test? >>> Yes, I've just tested next-20180920 only with the first patch from this >>> patchset and the mentioned change to drivers/mmc/core/pwrseq_simple.c. >>> It boots fine, so indeed the issue is in handling of arrays of gpios. >>> >>> Just to be sure I did it right, this is my change to the mentioned file: >> Yeah, that's what I had on mind. However, I'd be more lucky if it didn't >> work >> for you. Setting the pins sequentially, not simultaneously as before, >> was >> exactly what I hoped was the reason of the hang. >> >>> diff --git a/drivers/mmc/core/pwrseq_simple.c >>> b/drivers/mmc/core/pwrseq_simple.c >>> index 7f882a2bb872..9397dc1f2e38 100644 >>> --- a/drivers/mmc/core/pwrseq_simple.c >>> +++ b/drivers/mmc/core/pwrseq_simple.c >>> @@ -38,16 +38,11 @@ static void mmc_pwrseq_simple_set_gpios_value(struct >>> mmc_pwrseq_simple *pwrseq, >>> int value) >>> { >>> struct gpio_descs *reset_gpios = pwrseq->reset_gpios; >>> + int i; >>> >>> - if (!IS_ERR(reset_gpios)) { >>> - DECLARE_BITMAP(values, BITS_PER_TYPE(value)); >>> - int nvalues = reset_gpios->ndescs; >>> - >>> - values[0] = value; >>> - >>> - gpiod_set_array_value_cansleep(nvalues, >>> reset_gpios->desc, >>> - reset_gpios->info, >>> values); >>> - } >>> + if (!IS_ERR(reset_gpios)) >>> + for (i = 0; i < reset_gpios->ndescs; i++) >> The only difference from the behaviour when the hang was occurring is now >> the order the pins are manipulated. Maybe that matters? >> Could you please retry the same with the order of pins reversed, either >> in >> the .dts file or here inside this for loop? > > I've switched the order of pins in dts and next-20180920 + first patch + > above > change also boots fine. Thanks for performing those tests. Since we are not able to reproduce the issue by any means other than using the original code introduced by fast bitmap processing changes, regardless of the first fix being applied or not, and we are only able to resolve the hangup by excluding affected use case from the fast path, we have to assume one or more bugs which affect mixed arrays, i.e., those which apply for fast bitmap processing only in part, may still exist in the code introduced by the fast bitmap processing series. I hope we are able to resolve it soon, before the changes reach mainline. Thanks, Janusz > Best regards > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland > >