Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2892503imu; Mon, 19 Nov 2018 07:41:09 -0800 (PST) X-Google-Smtp-Source: AJdET5cKfMbfT0+qMfaUs+xJfhhYpXIoNP3l6K7oMG4OaUQ0dQ1NITe9KFCtXN7XfQHY0yIMdv9+ X-Received: by 2002:a62:15c3:: with SMTP id 186mr24176152pfv.240.1542642069889; Mon, 19 Nov 2018 07:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542642069; cv=none; d=google.com; s=arc-20160816; b=w0unZAyKjs5uJ0/WF0rxCnOPPZIvhFbH+P7Jofy07OV0ZYi2QWGjf+Kx75OU3yRzIU 2czd33iGDH+ehS2DhjqJ3rXV6yqxoxlnQZxrxJJn5KxnvrSdl4U9fDKsvV1QbHHAL4nj pOe/b2hu5rqIqOcwFNTMoNMmdUw3Wz3Nd4JHEWzq1kacSQ93uQv5T+TW4IO06Lbb0oUr DQ90cz5h7xXZsEqi41lv+PU2NXzZKqmEFHooJIEF3CPV3gYyeOmi3oJK2a9i8qlnOTnP G+aAJ4kl6eQpWABTEPYordwr88rk/vPlIsvLHVuXZPTG3d4eHa8JXkj0uOsZZsUhLSnO xlBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=77j1Uv/Nd6jcni8FrYSrkmBq72ETw8A4ySylarrIiKs=; b=yzBdC6dZBUOoJ3mkXBhJtGuLDbRo9KR5T83RWX8mc0KpJRV4vTuv3VPFyL70WnyB54 74EzSRrPL17RBhtvct3QSFcpYHqW4ytnPxOtd5afWAoTdAQRY6Pj0xTm6Z1O2OEEd2Tj lePU/nCjGHvI7STyIYBDRh1oYSM6pT2z23X6tPFkGdrEAsTXYvaolH/yLlslKA+9+1/2 BaH/gHKUSb4Yxc32a0GgJLNqHrAj2Cjq8/81nqk0zsVq+G12MiQjOlFRQgYQzvg3BXVc 8xbl2XR7fimHMlf81FBY/Hcl98RaFGffER1etn5IMRpr22ODzFs8chVFEv6h4QNPIPh/ YCLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si38911769pgl.209.2018.11.19.07.40.54; Mon, 19 Nov 2018 07:41:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbeKTCEO (ORCPT + 99 others); Mon, 19 Nov 2018 21:04:14 -0500 Received: from mail.bootlin.com ([62.4.15.54]:50433 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729746AbeKTCEN (ORCPT ); Mon, 19 Nov 2018 21:04:13 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 6065320D27; Mon, 19 Nov 2018 16:40:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 0A91820CFD; Mon, 19 Nov 2018 16:40:05 +0100 (CET) Date: Mon, 19 Nov 2018 16:40:05 +0100 From: Alexandre Belloni To: Andrew Lunn Cc: Andreas Schwab , Quentin Schulz , davem@davemloft.net, f.fainelli@gmail.com, allan.nielsen@microchip.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, thomas.petazzoni@bootlin.com, linux-riscv@lists.infradead.org Subject: Re: [PATCH net-next v3 1/6] net: phy: mscc: migrate to phy_select/restore_page functions Message-ID: <20181119154005.GA8367@piout.net> References: <20181008100728.24959-1-quentin.schulz@bootlin.com> <20181008100728.24959-2-quentin.schulz@bootlin.com> <20181119151057.GC26852@lunn.ch> <20181119152830.GE26852@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119152830.GE26852@lunn.ch> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/11/2018 16:28:30+0100, Andrew Lunn wrote: > On Mon, Nov 19, 2018 at 04:13:10PM +0100, Andreas Schwab wrote: > > On Nov 19 2018, Andrew Lunn wrote: > > > > > On Mon, Nov 19, 2018 at 03:57:17PM +0100, Andreas Schwab wrote: > > >> On Okt 08 2018, Quentin Schulz wrote: > > >> > > >> > The Microsemi PHYs have multiple banks of registers (called pages). > > >> > Registers can only be accessed from one page, if we need a register from > > >> > another page, we need to switch the page and the registers of all other > > >> > pages are not accessible anymore. > > >> > > > >> > Basically, to read register 5 from page 0, 1, 2, etc., you do the same > > >> > phy_read(phydev, 5); but you need to set the desired page beforehand. > > >> > > > >> > In order to guarantee that two concurrent functions do not change the > > >> > page, we need to do some locking per page. This can be achieved with the > > >> > use of phy_select_page and phy_restore_page functions but phy_write/read > > >> > calls in-between those two functions shall be replaced by their > > >> > lock-free alternative __phy_write/read. > > >> > > > >> > Let's migrate this driver to those functions. > > >> > > >> This has some serious locking problem. > > > > > > Hi Andreas > > > > > > Could you be more specific. Are you getting a deadlock? A WARN_ON? > > > > See the stack trace. That's where it hangs. > > So you never said it hangs. The stacktrace helps, but a description of > what actually happens also helps. And i expect Quentin has booted this > code lots of times and not had a hang. So some hits how to reproduce > it would also help. Maybe your kernel config? > > I'm interested because he is using the core mdio locking > primitives. If those are broken, i want to know. > My first intuition is that he mac driver quentin is using does phy_connect when the interface is opened while macb is doing it at probe time. I didn't investigate but maybe this can help :) -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com