Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2841730imu; Mon, 19 Nov 2018 06:58:24 -0800 (PST) X-Google-Smtp-Source: AJdET5fIIPi4+6qj+sH8stV3MhqIGHKzY90reE6hdkIRqUGQAMY49RgJJxZ92dluKt7Nsn/CVghz X-Received: by 2002:a17:902:7791:: with SMTP id o17mr22444198pll.60.1542639504509; Mon, 19 Nov 2018 06:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542639504; cv=none; d=google.com; s=arc-20160816; b=FJh2h5/aHgNwQUHGsFx8gAjmRZlzLy/xYzK7Hxq/WARM7zwYfUJnA/1PzL1Q6hYUvc pJLpVwHBttpHIIxTWp/g6GAg1ijaxvHnIhJzuElWlvKFTguqvCjCGKzVU0u2KozBwnky F3/l8AduCD5ExJYBVYLvLZ1LNiK8z6zKIfmh3rYNgaxe94VAL6h08fCaxjcW6kXI87UV ymC3n0vuFp6GvsSwIK2tk5cAtpMWfnxzSWdz5WgJNXVNhwFmOX68CHuOxj9vtuQHVmHN xzK91dfAO0iHA0IZ7l1T8XL97vE/IjL+rwmeVJI2BreYWhhid0na2lFXGz/gs7MG6AcJ WSvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=uqbTCtADTeHUFEh07nXTxhTn2X6GYzWbawSxFF1MaHk=; b=KJ/xMzIC+FHO8sFtCWsy2Im+sNcmG2hbJjHGMzXaAnlTct2qPM9P4rkozm7kC/VCie Yo8hGMwD8RKKjMsDlEyTWDea3561W/1YIyqnfXEobI1Mpocraz6n2tWEpDvvz8EdHBDa ietIryYjK1m9quDIOJebfgYdv/E3UOwsfbmgfyI8VCKL9LK273Wbi6EquQiDo0oUuwpF PxTYzeo01fFYGFAuiLo0W+R+4yDrE89W6SsmZt+zrwZbkCqzCkB3YYwA2WhvWuS5eR/h LMtl9j3DHwg6BKgzDdj8gUSXH61IrDAJXMa29UH0FJFJcUKQW6/2WToo16mFcydvU++d TrEA== 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 m7si39853497pgi.547.2018.11.19.06.58.09; Mon, 19 Nov 2018 06:58:24 -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 S1729667AbeKTBVK (ORCPT + 99 others); Mon, 19 Nov 2018 20:21:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:39774 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729376AbeKTBVK (ORCPT ); Mon, 19 Nov 2018 20:21:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0C4DEACE5; Mon, 19 Nov 2018 14:57:18 +0000 (UTC) From: Andreas Schwab To: Quentin Schulz Cc: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com, allan.nielsen@microchip.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@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 References: <20181008100728.24959-1-quentin.schulz@bootlin.com> <20181008100728.24959-2-quentin.schulz@bootlin.com> X-Yow: Where's th' DAFFY DUCK EXHIBIT?? Date: Mon, 19 Nov 2018 15:57:17 +0100 In-Reply-To: <20181008100728.24959-2-quentin.schulz@bootlin.com> (Quentin Schulz's message of "Mon, 8 Oct 2018 12:07:23 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. [<0>] __schedule+0x25e/0x74c [<0>] schedule+0x1a/0x58 [<0>] schedule_preempt_disabled+0xc/0x14 [<0>] __mutex_lock.isra.0+0x10e/0x22e [<0>] __mutex_lock_slowpath+0xe/0x16 [<0>] mutex_lock+0x22/0x2a [<0>] mdiobus_read+0x36/0x60 [<0>] vsc85xx_config_init+0x4c/0x1e2 [<0>] phy_init_hw+0x3c/0x52 [<0>] phy_attach_direct+0xec/0x1dc [<0>] phy_connect_direct+0x1a/0x56 [<0>] macb_probe+0x800/0xb5e [macb] [<0>] platform_drv_probe+0x3e/0x7e [<0>] really_probe+0xba/0x310 [<0>] driver_probe_device+0x54/0xf2 [<0>] __driver_attach+0xde/0x106 [<0>] bus_for_each_dev+0x4a/0x72 [<0>] driver_attach+0x1a/0x22 [<0>] bus_add_driver+0x1ce/0x212 [<0>] driver_register+0x3a/0xd0 [<0>] __platform_driver_register+0x3a/0x42 [<0>] macb_driver_init+0x20/0x28 [macb] [<0>] do_one_initcall+0x48/0x128 [<0>] do_init_module+0x4a/0x186 [<0>] load_module+0xd6a/0xe6a [<0>] sys_finit_module+0xc6/0xfc [<0>] check_syscall_nr+0x22/0x22 Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."