From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F35FC433B4 for ; Fri, 21 May 2021 12:54:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 838AC613D8 for ; Fri, 21 May 2021 12:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbhEUMzw (ORCPT ); Fri, 21 May 2021 08:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235745AbhEUMyl (ORCPT ); Fri, 21 May 2021 08:54:41 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88FC5C061355 for ; Fri, 21 May 2021 05:52:47 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id c10so8519487lfm.0 for ; Fri, 21 May 2021 05:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LBz0N/H2AYuYTe99L8IN2L1BlOwoBdUWjJLDEKhnr/c=; b=T69z0LmTzeJXqaXwhcq8MJjVHKJXg9U71fbL/y7Ge+6wDLZz1pVZIXbwHFa6W1Efhb pXq5DGM4oK9ZwQpLcgd5ruvaTx4X9xrzjlWK7urFF+j1pjVHhXctaxXaoRyMEWGFq0wO eoNhHljM27F8zq6cXzucBN0qYlBKNa80Vxl0M0EtllYx/6PXZ2yufMu63S3xwB/MEFyJ +TmEnHfIz4DoOsm7R6qyL1EclVXT/VlQUWp5KadgT7sLGv7UNRBqSEBVXeJWy3ow2LrW iVWDRTIUWF8Kx0mM0ZZjNCDYMt/uiz7puubquehd6sfCdjrst/HOILtXG9yY42WHICDh /2ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LBz0N/H2AYuYTe99L8IN2L1BlOwoBdUWjJLDEKhnr/c=; b=cvnSUhB+RgAfZZrlcrz1vW+o8II/979FtDCsB2HC9CxrL8kh06gbzGJAGdpMMnsCzj E6Okxkim733lEaYX850aURhtFXvsa1ZZ7//2XnEqvqulK3taH5mF5gZI6wyZ5cY5rKD1 Vh0ti/79/584sicYVrNucNXk8IhRn3UtHIHPCItoY910giIlPxJtgjJUFiHstrQ+L3Lg +xkja10+9gAh6YtSSwl8edKoLvbBW8UUPNTQ2KzokgMlLjKQI9s0jvHpgRzllmMDUOjz EpgHCqEE+WCZeR8xWc6VR3VIfZBh3eY1bQeBiW7VBfS0Vj7X6j8eI5sB5i5YnaH69zHM vNCg== X-Gm-Message-State: AOAM530WKQbkyvBMtGtHZiwdU6l+YFBmidx/s4MAREL//KRq+XtXuIMd 4ped1WtyZMb/AF+Fq/L/T/1+wWWTyV8K8vU7Ppf8agfLVRUIQg== X-Google-Smtp-Source: ABdhPJxJCEu3ybVS+4YwTXi9Tv690RJ4IER7AHDybYUJS0fNdZNOP5aGEAudYSxXd7RnRNi7iCN5Dn8fXIIQnydPELI= X-Received: by 2002:ac2:53b2:: with SMTP id j18mr2135683lfh.127.1621601565829; Fri, 21 May 2021 05:52:45 -0700 (PDT) MIME-Version: 1.0 References: <20201209094916.17383-1-zong.li@sifive.com> <87v99qyjaz.fsf@igel.home> <87lfaj7cki.fsf@igel.home> <871rc4on36.fsf@igel.home> <87a6qrk2pw.fsf@igel.home> <874kgyfetu.fsf@igel.home> <87h7kukzy4.fsf@igel.home> <87tuob7n8g.fsf@igel.home> In-Reply-To: From: Zong Li Date: Fri, 21 May 2021 20:52:35 +0800 Message-ID: Subject: Re: [PATCH v7 0/5] clk: add driver for the SiFive FU740 To: Geert Uytterhoeven Cc: Yixun Lan , Andreas Schwab , Paul Walmsley , Palmer Dabbelt , Stephen Boyd , Pragnesh Patel , Albert Ou , Michael Turquette , "linux-kernel@vger.kernel.org List" , linux-clk , linux-riscv Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 6:34 PM Zong Li wrote: > > On Thu, May 20, 2021 at 2:17 AM Geert Uytterhoeven = wrote: > > > > Hi Zong, > > > > On Wed, May 19, 2021 at 5:55 PM Zong Li wrote: > > > On Tue, May 11, 2021 at 4:57 PM Yixun Lan wrote= : > > > > On Wed, Apr 14, 2021 at 2:25 PM Zong Li wrote: > > > > > On Mon, Apr 12, 2021 at 7:31 PM Andreas Schwab wrote: > > > > > > On M=C3=A4r 31 2021, Zong Li wrote: > > > > > > > I found that the gemgxlpll was disabled immediately by power > > > > > > > management after macb driver install. The mainline's defconfi= g doesn't > > > > > > > enable CONFIG_PM, so the network is fine on it. The opensuse = defconfig > > > > > > > enables CONFIG_PM, and the patch > > > > > > > 732374a0b440d9a79c8412f318a25cd37ba6f4e2 added the enable/dis= able > > > > > > > callback functions, so the gemgxlpll PLL, I have no idea why = power > > > > > > > management disable it, I would keep trace it. > > > > > > > > > > > > Does that mean that CONFIG_PM also affects the FU740? > > > > > > > > > > Yes, we got the same problem on the FU740. We are checking the is= sue. > > > > > > > > > Just a mild ping, any progress regarding this issue? > > > > > > Currently, if runtime power management is enabled, macb driver would > > > go to sleep at the end of macb_probe, then the gigabit ethernet PLL > > > would be disabled. During this period of time, the system would hang > > > up if we try to access GEMGXL control registers, it means that we > > > can't access GEMGXL control registers before the gigabit ethernet PLL > > > is resumed again. There are some cases, for example, if we execute th= e > > > > Sounds familiar. > > > > > 'ifconfig' command, it would eventually go to the macb_get_status to > > > > Do you mean mac_get_stats()? macb_get_status() does not exist. > > Sorry for the typo, it should be macb_get_stats. > > > > > > access GEMGXL control registers and cause the system to hang up. Give > > > more example here, if we execute 'ip link set lo up & ip addr add > > > 127.0.0.1/8 dev lo', it would cause the system to hang up, because > > > these commands would try to query the interfaces and eventually go to > > > macb_get_status as well. However, if we can resume the gigabit > > > ethernet PLL first, such as 'ip link set eth0 up' or 'udhcpc', then > > > everything goes well. I'm trying to figure out if there are some hook= s > > > that we can check the PLL status in the macb driver before it actuall= y > > > touches the control registers. If anyone has an idea about that, > > > please feel free to point it out to me, thanks. > > > > And you cannot call pm_runtime_get_sync(), as this is called from > > atomic contect. Other drivers avoid accessing the registers while > > the device is not up, cfr. e.g. commit 7fa2955ff70ce453 ("sh_eth: > > Fix sleeping function called from invalid context"). > > > > Thanks for your help. I have done the similar modification by > following the patch you provided. I also verified the bug that we use > pm_runtime_get_sync there. I'm going to post the fix patch by adding > the is_opened flag. > > Thanks again. I have posted a patch to fix this problem. Many thanks to all in this threa= d. https://lore.kernel.org/netdev/20210521124859.101012-1-zong.li@sifive.com/T= /#u > > > Gr{oetje,eeting}s, > > > > Geert > > > > -- > > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-= m68k.org > > > > In personal conversations with technical people, I call myself a hacker= . But > > when I'm talking to journalists I just say "programmer" or something li= ke that. > > -- Linus Torvalds