Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1953242rwd; Wed, 17 May 2023 03:53:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4sufJ/UGRw0R8lpBJgs+M22d6J7A0qzyRK4ZDy0YIST9H+uJ8zKU1KdD0bHWkE0xdZve+e X-Received: by 2002:a05:6a00:882:b0:643:4d69:efb8 with SMTP id q2-20020a056a00088200b006434d69efb8mr469971pfj.6.1684320811347; Wed, 17 May 2023 03:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684320811; cv=none; d=google.com; s=arc-20160816; b=IXah1mnUPypRiaYmz2egTdLVQaU65O/1U4ExjrK9Qu9fsO5bNpRY5VA0ZPuKv16XYQ BCv2btd2uxUgaVpJRVyPuLzEemqlUBNV/b+tqhLHww1T2iMa3pjdxXp1KjSrSH+aARRF Bol8FdCJFjp07dV6uuFU7tD4iXMtNGieXjy2yMsHiacQesHr7JrMjTZ5lohkG0Wp7fLV MUBzQlvOeoCCg8PJfrik5nJ4ib7FwqwV9a1DnD4y3dYd6clUk2CDMo6xYXkAj2UQGDog 3FYN+oEV65RfUgGGRphYEsewba3ITEf8J/rwiinr4TgftkPzsXoiM74xUbDzUgUaLIzN 0+Xw== 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=I+yMSRIvro+oycNAw5kvcuepkix/lZDUJXF17xDJqQs=; b=hg90zUwpmJuwD608fcJiHHF05xrtjPyDxEW5bn9K31T8PoMRr3sN0k4PONFnOc2z6L 9CUfB8Mn4qlqDchbcH3xxTa0oO289gjr0jcB6vadm90nIT2Nr8cNmgXREy+lkld95Uwz YBfFe3KtT6hW7hTTSihUZmD1wmJ/Uam+ku1f7K7dR+J4NSH2xtpGLtuKuw9UB/FDmEqc vPO5dkZCsW+dLLbLTghy8OGtGeUV6HxUIS0sP53RwuIzylXa5H82RPm+cl/UV+D77OTH NBMMiuxRViTeKEMnM17NTF1xnDAHgYC/hdf1f7ckQvpfOBYjnFqLeMxuuEBAAOtaPYqM siKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=r79UGOC2; 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 e5-20020a63aa05000000b00528595a1390si20781381pgf.588.2023.05.17.03.53.19; Wed, 17 May 2023 03:53:31 -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=r79UGOC2; 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 S230387AbjEQKdH (ORCPT + 99 others); Wed, 17 May 2023 06:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbjEQKdF (ORCPT ); Wed, 17 May 2023 06:33:05 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A6449C9 for ; Wed, 17 May 2023 03:33:03 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5341737d7aeso493373a12.2 for ; Wed, 17 May 2023 03:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684319583; x=1686911583; 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=I+yMSRIvro+oycNAw5kvcuepkix/lZDUJXF17xDJqQs=; b=r79UGOC27PdAxNjuhydpx7NpMnekSB4YkiixqH6+hR3Gn3K6V4tG7PdEPzQUuu3VwZ RagVi1Ho5iB5GIKbC7A3u5cjAh+JUIpRyh/8EapJzQ2Cejk0drmRiq4NM+BIWMBLyS7Z 9PNyLcuQ4rDCtpC2LVUP5eejvj276UFY+yZk8cXHMXCyB07zS0DOX2bsuKDDJeUpvQBs t1Lb+Eytf9VfC/Ck2ak8USU5L6Kd+Igx6iEEn4UChj5bx0AKMnm3UMgkgGEH2KSQP19A iUXJeK81eLwgmFs5xr+cuhWT4MI0mjsrxyhv6H8OsvGXoBB8rRojw13sA3ac0knI8MZH 3hoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684319583; x=1686911583; 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=I+yMSRIvro+oycNAw5kvcuepkix/lZDUJXF17xDJqQs=; b=bSKavCeB+gxYrTpHRV5EzMAxlFpEPHTRCDo5OlG8/wfOA1njXe27UgwxEZr1cOyduJ CDuEv6K87TyKtLaOZ8qMnT/iet+asbDFgXEi1Seq/vovfb2iarfzbcnyGS6eE1pz+mqS 0B9uYjnCs05IFBlLp6BWG/ETnfL3/3Csy3XGvFnfXBZY/qXgrugHJCv+trg8ydWS+7UL Mk05dDlQZC7FRZ4Fc39v8URJcYwGOb+CFV0ygSmK3L3zJZkBItmdfLhKhXb8JKD0CwZx mT2f1f9Ej4lCU8/QVqIjCUiwrj0n7d3jIL044Pn49hcb1+sg8r6b8sGw4Iw+vlQYc4gn Gfbw== X-Gm-Message-State: AC+VfDwvtJMojrcD1UAj/vryGYEpnm3eo7gQXt255RSiwlxxaWxgXJEN 1wboenBHt58WtCAMxiT8MBiJD01spzOXAYwmowI1eA== X-Received: by 2002:a17:902:b593:b0:1ad:ea13:1918 with SMTP id a19-20020a170902b59300b001adea131918mr16342513pls.69.1684319582817; Wed, 17 May 2023 03:33:02 -0700 (PDT) MIME-Version: 1.0 References: <20230407030741.3163220-1-badhri@google.com> <0cf8c588b701d7cf25ffe1a9217b81716e6a5c51.camel@alistair23.me> <1ac16f0a-3cca-40ca-c444-82719f85a24c@leemhuis.info> In-Reply-To: <1ac16f0a-3cca-40ca-c444-82719f85a24c@leemhuis.info> From: Badhri Jagan Sridharan Date: Wed, 17 May 2023 03:32:26 -0700 Message-ID: Subject: Re: [PATCH v4 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started To: Linux regressions mailing list Cc: Alistair , gregkh@linuxfoundation.org, stern@rowland.harvard.edu, colin.i.king@gmail.com, xuetao09@huawei.com, quic_eserrao@quicinc.com, water.zhangjiantao@huawei.com, peter.chen@freescale.com, balbi@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Francesco Dolcini 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=unavailable 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 Hi Thorsten, Francesso had shared the stack dump as well at https://lore.kernel.org/all/ZGMm2sxN6wW%2FEWrR@francesco-nb.int.toradex.com= /. I am working on a fix based on that. Going to share it in the next hour and would be requesting Franceso and others help to see if the regression goes away. Thanks, Badhri On Wed, May 17, 2023 at 3:23=E2=80=AFAM Linux regression tracking (Thorsten Leemhuis) wrote: > > [CCing Francesco Dolcini; and the regression list too, as it should be > in the loop for regressions: > https://docs.kernel.org/admin-guide/reporting-regressions.html] > > On 16.05.23 14:53, Alistair wrote: > > On Fri, 2023-04-07 at 03:07 +0000, Badhri Jagan Sridharan wrote: > >> usb_udc_connect_control does not check to see if the udc has already > >> been started. This causes gadget->ops->pullup to be called through > >> usb_gadget_connect when invoked from usb_udc_vbus_handler even before > >> usb_gadget_udc_start is called. Guard this by checking for udc- > >>> started > >> in usb_udc_connect_control before invoking usb_gadget_connect. > > [...] > >> Cc: stable@vger.kernel.org > >> Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler") > >> Signed-off-by: Badhri Jagan Sridharan > > > > This patch causes a kernel hang when trying to boot with the > > usb/chipidea/udc.c driver. > > > > The call stack below causes the hang: > > > > - gadget_bind_driver(struct device *dev) > > - mutex_lock(&udc->connect_lock); > > - usb_gadget_udc_start_locked(struct usb_udc *udc) > > - udc->gadget->ops->udc_start(udc->gadget, udc->driver) > > > > At which point we are calling ci_udc_start(..), but with the > > connect_lock mutex locked. > > > > ci_udc_start() then calls usb_udc_vbus_handler() which tries to lock > > the connect_lock while it's already locked. Resulting in a kernel hang. > > > > Reverting this patch fixes the hang. > > Not my area of expertise, but I guess it might be the same error as this > one: > > https://lore.kernel.org/all/ZF4BvgsOyoKxdPFF@francesco-nb.int.toradex.com= / > > Francesco sent a revert on Friday, but no reaction from Badhri Jagan > Sridharan or Greg yet afaics. > > https://lore.kernel.org/all/20230512131435.205464-1-francesco@dolcini.it/ > > Ciao, Thorsten