Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1072412pxj; Fri, 21 May 2021 05:58:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRXBQ6Bom0miDFpkdB3HAiLXv0SRwqc6Tnb4Dsw+0TLkC0ZvGQdezgVNtnidVhDmLREdAH X-Received: by 2002:a17:906:a245:: with SMTP id bi5mr10647243ejb.316.1621601907824; Fri, 21 May 2021 05:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621601907; cv=none; d=google.com; s=arc-20160816; b=WsJElNFvQeLNRcB4ejYAKJoylfHWZrNEv6ja6YN9F7T8N0+DjJBMjEhMFEiLJj4omL 84A6kzZbpDNRFVQpTM5ChoyuwERNLQMVft//6reXi6xPn9UZo9xxg5VlaLRYDb9MPzhJ sMfhNARKt/J/R/IFMYWzszu2FNF872Ygy9kkx/CZjRz0MVeAQlWIWm/mVwA6sRZAEJR+ J6Xwr8mv22AugyQmlOuPyRy93/dO+JLpEfMHOAxOmg4g+uLTn2HUBZPXhM2knsgCG5/q dvkn1dXdDSHqA+O4QnQmlqb0n0KnU3YPh6aKS3pOrPOgwQjD4PJmhOnjQJ5ErQplv22P R53w== 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=LBz0N/H2AYuYTe99L8IN2L1BlOwoBdUWjJLDEKhnr/c=; b=qrzJbJ8HV9tyZUqHL63DbOzq2NARNWnCIBLaqYOGSiikJr0opmT9RDPF008gkbgC4z nSfA6U14HShrV/TrifEuQl84tunqm/tMXGfn3FF74q3pVKeYQPuqiaIW4TssZGu6kTmA aO0wlyK8LS4fl5tpQ2ViGPRFQzBProQbEcuvDOpEHLdMQWiNHpA/O3iyE9v4gjN55LpB gro0fghFq1QCy29mfRHDSjRD4hFFw6Y/Qu/NmzmZW+77+uUGCEgCLeziQhU3odPj8dSh 3eJuyzTx8tt/jRbRuUHhHtvy7xsuiGe1xj7vK3ST1FM9eBryGN58ldcX4dPcAjdYSFsM xWDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=T69z0LmT; 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 k13si5462410ejc.326.2021.05.21.05.58.04; Fri, 21 May 2021 05:58:27 -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=T69z0LmT; 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 S231356AbhEUMzv (ORCPT + 99 others); Fri, 21 May 2021 08:55:51 -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-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