Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1396913pxj; Fri, 21 May 2021 13:13:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH6mG8hYajE4PadNebnzxETn4mzPvl1hhtKLZ0U6lmG/NeP1mqlTTG5Xw9oQJEVmSV8nzO X-Received: by 2002:a02:9f96:: with SMTP id a22mr7159763jam.14.1621628027288; Fri, 21 May 2021 13:13:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628027; cv=none; d=google.com; s=arc-20160816; b=mu6Mkl7RT0qYZM38DW56b4jJTlNgnFG8BIH+QEO2nPVwODF5nQf3atNAQEj3v/AMte aG0Gcy1N943mfV3CRJAChBfJiM4bWxuMppH1nFhgwiCJnqw1Sl9bZj7hWec2B3RHrjAh bVpD5FCjUsZNxXEg74ApUYwKxXvpndTCR7RfCuHmWWsWL90mhbC/g12UURbALLhCFV3x rX17dIisVzCD07c0fGn5pshfbydY3/Cq9P1PBHFrEOaD7LtgmtqL0litR7iNSKuK0PJO TETXVO5Yi1AOOj/lVBteIlnPx9SyJxXvE0bCGY2I1sivRfuAWK3NBwua0vWpZMOb/lVc sChg== 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=kK6AgO7HXHFP2fUm42xaKIkwVFtfr7s4UEqCfpCwl+E=; b=OCwEBGlWSgXgv/KxEOB/SJ5kD5UHDpHvToPazQtfqqjmO2OMNm5tUo6R5+aYmDy7bu TqG1cbCEy9uTRqXCv1xSR7UQJONRfcD2FsKxiUwvuGognU664D0WYpaUN56p9DUTBlHl 6ktnkLvEBwgVa1yrmK/ayMbJAF5YruI9xPGtmb2Vim2gRvYPz4vzgbcIHWyoJjDjw0MN HCUSZIvOUG71s0k49RD2u0he5hYLH3LoBI+XDru5DL8HImxmLVUi9cvgxFv92Jh9+F1U mi75ItNYaUZumbiEhlMAKksm0sCNh7tCR0GIelsPJ5hbq84VId4OHfs2DNZJU6IGCId4 gm7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="KLXsG/m7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si6781583jan.4.2021.05.21.13.13.34; Fri, 21 May 2021 13:13:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="KLXsG/m7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbhEUKgR (ORCPT + 99 others); Fri, 21 May 2021 06:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230431AbhEUKgE (ORCPT ); Fri, 21 May 2021 06:36:04 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77604C0613CE for ; Fri, 21 May 2021 03:34:41 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id m11so28991945lfg.3 for ; Fri, 21 May 2021 03:34:41 -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=kK6AgO7HXHFP2fUm42xaKIkwVFtfr7s4UEqCfpCwl+E=; b=KLXsG/m7VYE4A5kFfihQ0nvrjjtWr64VfJ9MIsUDEDaoUyzf2ksfVsY/hmHWk438jS gLj5ArZ5pG1grRrw5FkQnoUQqQE+U7K5HcAHszoNLaxEkUxhOrVwF4qrvota1Kw2P2fe pWOQPAwZuwM86fZcM9Qamfdw6W8EZbZhEVbaHAxlS4c92PbRxLfLOk7VUZXk7wezpPQD Jvbi6GwEMC7NQBO8wtaqJIXJ/xzYIVlWYtwWcXOwtsrIdV0U6Ggiug4zcNbKq6f6svKx fRTRkXhcnT6KVbQFcDaqdUxDGlslzVyddWeW13BVjEfs5MEZsJKGOJhaXYTHvvNv+Wpr BuXQ== 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=kK6AgO7HXHFP2fUm42xaKIkwVFtfr7s4UEqCfpCwl+E=; b=drln/ynK7P8w4MPSO2zUNBzXqIfT2F3ZSVgucLtWn4UCRbVz+Ud1Kor23EfT0OrCVu fKAKS4vJbgyPubIMJE/DfgqfMEnmnSI6h/iMaDYd6dg5gvRldwNF1yqBTJ64uMCFk0r4 OFk8Yw2yt4clQWe67fjeoPUv9rQyNtsVTOF9WAAoGVb/7fU/vodKNwByZ2QWNAFBKee8 qsW6V82vRccGGR7Kpluro+cuXjn1DN/SYBBT4bBxjl5QtBFU452KjmeMcCFd/r72+uL0 d7R/9QsgZsQY1Qj/vfQgpzkdYeeJPb7ErGDOKGZXiUZdyM6DpJKzvP//wRYj7Ig4hmsJ 2o1A== X-Gm-Message-State: AOAM533/co/tn4SvKRMxv+9IIQDc92nj0OtUG5x5cMSaQ8oG6DkdAGHP iyMJxpFhKdutMsLOcEd9jUtXg8hN6He4S9uvSBaJZw== X-Received: by 2002:a05:6512:471:: with SMTP id x17mr1771096lfd.553.1621593279771; Fri, 21 May 2021 03:34:39 -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 18:34:28 +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 Thu, May 20, 2021 at 2:17 AM Geert Uytterhoeven w= rote: > > 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 defconfig = doesn't > > > > > > enable CONFIG_PM, so the network is fine on it. The opensuse de= fconfig > > > > > > enables CONFIG_PM, and the patch > > > > > > 732374a0b440d9a79c8412f318a25cd37ba6f4e2 added the enable/disab= le > > > > > > callback functions, so the gemgxlpll PLL, I have no idea why po= wer > > > > > > 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 issu= e. > > > > > > > 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 the > > 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 hooks > > that we can check the PLL status in the macb driver before it actually > > 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. > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m6= 8k.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 like= that. > -- Linus Torvalds