Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp229315rwr; Tue, 2 May 2023 19:35:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5IfOqYBI3Z/hzVjh1ZxySY27CHshxsBx48UBYNL++jD5+dcD1RijK6Rd/7kRMLWOEkSCw2 X-Received: by 2002:a17:902:ecc8:b0:1a6:4127:857 with SMTP id a8-20020a170902ecc800b001a641270857mr822473plh.5.1683081312799; Tue, 02 May 2023 19:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683081312; cv=none; d=google.com; s=arc-20160816; b=lKzup2KnxcErMYNrvPoTKG+1d7YqDjku643E4DvS3ZAh/fBobNNnuPykh9PLy1uT1K f83JX7xms2FSYi4hl1IJpnIav38iysCL2QYbTDYhTMW6MpeV7T/4ZJV6gA8W7k9HgF/6 2Q1/Vd9kRuuISbXYWhfXcQGZdKePiz6yTlC8rGJijs45PUxq3scaavke7rZTfze7jMME jzX2E2yJuRsoPlcnRjPbfJ5VlooiH+hveEZaeCLdLCnKQJGnNjbujPPC/8H2fnLojthF C85rG/7TlnKOAyzuf1pRAMYJiAmKmWjVfcQRSOywB+S0RXnqcphEiYMo0MdAfzm4aJEM wEDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ctb1R3fy35Ln0l9ZfEUNBbFNpKA3q8wClyqzrQTbJpg=; b=DqyiNH1pLxZIhY1bI8Bkp35s6eXF8H5k+I+x+OmPzAklqTMqqJyDURwoUX+eg9UxvT oysXkKFC+65zpBr9wHTHw8EOqzejmeLtVO8WsKpH2b1ewQNeR8V6AIJtCe92Usom+MQU VrXp/tB+UGXEvqKHGsjTXIEPt49lIwQSrFVPBpikT+i7WzKY2dHBcetEYpOotMB4yN42 fPtkiRl8D7isN9XuT+ao2vwFG0C2+3zTrqOsifle02hY4vZYARrOGeoBvFH7MESdfh78 7gFgQofD5dvdwZRHPKOvrMydPz1Cu4wwqS5m4KbVu6WgOUdOYKxpu78E6POkf+QE/MiJ XzgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=21rXa6BK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g2-20020a170902740200b001aaf22746cdsi6449720pll.35.2023.05.02.19.34.58; Tue, 02 May 2023 19:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=21rXa6BK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229441AbjECCTf (ORCPT + 99 others); Tue, 2 May 2023 22:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjECCTd (ORCPT ); Tue, 2 May 2023 22:19:33 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59FF42D69 for ; Tue, 2 May 2023 19:19:32 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1a950b982d4so161715ad.0 for ; Tue, 02 May 2023 19:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683080372; x=1685672372; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ctb1R3fy35Ln0l9ZfEUNBbFNpKA3q8wClyqzrQTbJpg=; b=21rXa6BKPsH1Q9DLffrghLCDtdO0rxkfIfXzRBY90U2BKxFSxAilOuBXsbhudPcv3r 4QloLZeDs+Yzqgxyb6xfURzZRHYcsF1T3ICzP98bkBVwp8QlqwZqUKot6sfzZrAod4wA RnBM15xsIT31n8nDArb9G1R8SHb2Ll/jnt5P77w86TOmhoT5dbyewEnjwKRrQGO9NJU3 5ELCU3L2UB8vAsU3nILJzhTq2BNmgtA8gK4S9Bm7ZQodM1D3jq7jfjBs/4Iq/v/Y/QJW WYMl6Mmuc5HH/xFkh0y8mqVfJjcTDAkSZ1jnM4XSpFf5mfjEv/P4g+23kyw78tFTVqX2 hfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683080372; x=1685672372; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ctb1R3fy35Ln0l9ZfEUNBbFNpKA3q8wClyqzrQTbJpg=; b=R5OWMMrdkBwT5uDvO3WEF0cYNzjzretmbfwvBDKJihmoZdxYStRuL/Yac50LKlwP3J JhH26PK2WYgK2WZLS4TZXnq2svNqx3osYj8PedAnD2yEVRsaqBj0DS4p94BCasMYYQX2 NNiOU5sYkgr1xAN01jE7giTa+K5/BttWl46/k6YmTlOngY6KP9k+/uKEjxpAXlp8LWLV reRHt1dwwG5eQbjLB/pDll6D1grqQmGIe8gd5+C7Cy6ICxB9iJXt2OkZn4HGekERmaZR PHD7PdBl4DgeMqF+CUmUF/qAhzRR4RpXJPCPP/eYGNzFIVlA8CSOTBy8y4vA5Z6P+u29 6MMg== X-Gm-Message-State: AC+VfDyDTIgsP/RaIBNanz5DRTWcq47nUB1FCikJRNxi+NbVCGmrxKrQ Vck4lK5kW9Zge7xzSFTSjSK7lF1zAj5GzGRjEVjKig== X-Received: by 2002:a17:902:ce8b:b0:1a6:760c:af3d with SMTP id f11-20020a170902ce8b00b001a6760caf3dmr139870plg.16.1683080371574; Tue, 02 May 2023 19:19:31 -0700 (PDT) MIME-Version: 1.0 References: <20230427221625.116050-1-opendmb@gmail.com> In-Reply-To: From: Saravana Kannan Date: Tue, 2 May 2023 19:18:55 -0700 Message-ID: Subject: Re: [RFC PATCH 0/3] input: gpio-keys - fix pm ordering To: Doug Berger Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Dmitry Torokhov , Lad Prabhakar , Gergo Koteles , Jonathan Cameron , Andy Shevchenko , Dan Williams , Hans de Goede , Thomas Gleixner , Kees Cook , Kishon Vijay Abraham I , Florian Fainelli , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Android Kernel Team Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 1, 2023 at 1:40=E2=80=AFPM Saravana Kannan wrote: > > On Thu, Apr 27, 2023 at 3:18=E2=80=AFPM Doug Berger w= rote: > > > > Commit 52cdbdd49853 ("driver core: correct device's shutdown > > order") allowed for proper sequencing of the gpio-keys device > > shutdown callbacks by moving the device to the end of the > > devices_kset list at probe which was delayed by child > > dependencies. > > > > However, commit 722e5f2b1eec ("driver core: Partially revert > > "driver core: correct device's shutdown order"") removed this > > portion of that commit causing a reversion in the gpio-keys > > behavior which can prevent waking from shutdown. > > > > This RFC is an attempt to find a better solution for properly > > creating gpio-keys device links to ensure its suspend/resume and > > shutdown services are invoked before those of its suppliers. > > > > The first patch here is pretty brute force but simple and has > > the advantage that it should be easily backportable to the > > versions where the regression first occurred. > > We really shouldn't be calling device_pm_move_to_tail() in drivers > because device link uses device_pm_move_to_tail() for ordering too. > And it becomes a "race" between device links and when the driver calls > device_pm_move_to_tail() and I'm not sure we'll get the same ordering > every time. > > > > > The second patch is perhaps better in spirit though still a bit > > inelegant, but it can only be backported to versions of the > > kernel that contain the commit in its 'Fixes:' tag. That isn't > > really a valid 'Fixes:' tag since that commit did not cause the > > regression, but it does represent how far the patch could be > > backported. > > > > Both commits shouldn't really exist in the same kernel so the > > third patch reverts the first in an attempt to make that clear > > (though it may be a source of confusion for some). > > > > Hopefully someone with a better understanding of device links > > will see a less intrusive way to automatically capture these > > dependencies for parent device drivers that implement the > > functions of child node devices. > > Can you give a summary of the issue on a real system? I took a look at > the two commits you've referenced above and it's not clear what's > still broken in the 6.3+ > > But I'd think that just teaching fw_devlink about some property should > be sufficient. If you are facing a real issue, have you made sure you > have fw_devlink=3Don (this is the default unless you turned it off in > the commandline when it had issues in the past). > I took a closer look at how gpio-keys work and I can see why fw_devlink doesn't pick up the GPIO dependencies. It's because the gpio dependencies are listed under child "key-x" device nodes under the main "gpio-keys" device tree node. fw_devlink doesn't consider dependencies under child nodes as mandatory dependencies of the parent node. The main reason for this was because of how fw_devlink used to work. But I might be able to change fw_devlink to pick this up automatically. I need to think a bit more about this because in some cases, ignoring those dependencies is the right thing to do. Give me a few weeks to think through and experiment with this on my end. -Saravana