Received: by 10.223.176.5 with SMTP id f5csp2683971wra; Mon, 29 Jan 2018 02:13:09 -0800 (PST) X-Google-Smtp-Source: AH8x227nDxsHONHf2uml6JaPA05YedR516n8r8yBUCIAGgw/ja+eMoG7a15e4gzLf0HH5T3lizt6 X-Received: by 2002:a17:902:221:: with SMTP id 30-v6mr21898556plc.134.1517220789876; Mon, 29 Jan 2018 02:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517220789; cv=none; d=google.com; s=arc-20160816; b=k7jjUxLFmbOMouonA6KpaxxLv7UGdPxdZhRsiHc8ufgZLH45dkEmSsfEa6WMxjIqys lRUsVph8VTB5WL0qseHsJv5A1nR3RU4Mp7yozRl1B12tnzQGQTYbVplpz/6WM9TLBmBQ rdnoV3+uBdEbuPqoXs+TPjOya9xc82o/GtgYsAkKXCwen6dSUBbV7Nj5vjig6iEuJf3g rOBu+4HWuP1cRYiI3lHRn3Y/bHUIkMKouyErsk9bkPTY1JNM6sLRuNkGTCVWibqGPGsA 35Qves73NGVRFm05ENEPW1KZqm10LqO/sBVjDNGgwUAfMWi4SLIOaBKV1yYOL9h9WUfo kXXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=+7qgL4jM2xHL+Cz2mV+XMzoATA4N+EgJS1IMJVWVn6c=; b=L17E+Y+OAJqnCdWiyzuqzB+XY9VYJ6j9eJnqXlVHfnR6n/O8K+08lKhvEX1npISwgP k8lClk+PANbQYgoP+TzSo2K9lBzmX9kyadMFiQPXo5rKqiZRKKqgqLKOztrL9iTuGRFg 2nnS6C8fJ/dAqSUg2ly+cNBsOxgujbwoN0ub7xUYvCdRXhfSmkzSbVE5aMbeh4SuzZnN W3oSnUUocJ3829MFHnXHWrk8uBOTAte9qJ3tsIq1V+WycDftSO10gquUsnnCYvv5Ce4I lLJgBeXBAi5HQQKGwroGbQOw08p7JjXBhZxj8rA0c4sdhSTVju5uyUXDpeT0qxMr+Xxy fF4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=PJWt5Lo7; 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 l2si1147739pgl.823.2018.01.29.02.12.54; Mon, 29 Jan 2018 02:13: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; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=PJWt5Lo7; 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 S1751374AbeA2KMa (ORCPT + 99 others); Mon, 29 Jan 2018 05:12:30 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33527 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbeA2KM2 (ORCPT ); Mon, 29 Jan 2018 05:12:28 -0500 Received: by mail-wm0-f67.google.com with SMTP id x4so44136512wmc.0 for ; Mon, 29 Jan 2018 02:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=+7qgL4jM2xHL+Cz2mV+XMzoATA4N+EgJS1IMJVWVn6c=; b=PJWt5Lo7rzLWsoTn5kFs0N3OE7wxSKqEM3gXrmHS/GvCkCcEb5/AKGcuxvlFB5MVEG SDAowZbGohBXiIm9ZASfup60h7C7mf4HsCsW/gwX3MS0zesszVwn3pfxepfMMFQu+z4h jQaVAKT5sNOxaTwNpsHeToomCpfcKpmWw8lT2to/iNLpmKGtYS8Y4aV/oODn/Q6XJFhD OSk/u0C5nBGWp82cASSWYHdMgNd/kp+ohBDOH+CsQTkzGBdMbI8z3/y52gPgrLnx1uln ucWaxxZDs6DPeoPkvneEQO3nzjyJw6WtwJPHA3AtoduqRXlMFryQSGUxNRWVdObpJA6M oD3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=+7qgL4jM2xHL+Cz2mV+XMzoATA4N+EgJS1IMJVWVn6c=; b=t9FenWEqCc1cXbdC2waHRh2MADY09nfbQo+sArDBoaybsDjEe7rB+1qce6SPRtPPAq 0YyrIV920IALmifaFr/yOzAaY8ghexNnTAfETpzaA4BnSClHpMCzFC7YAtCscFhoAs42 VYrDMmrQEKBUrKtpqfpMtpiEmtOKdZByrCzOlbnrOKdSktMqq4eIwieRrKPhjlRaZR8M iT3SO1Y9cAo/QK6Vw+d6xUAa7L8diuPITNjB6zFDWNsTT8sWguGsEJEaZo7KIv9mlHEU mkPqEtIQlYqvNxwbg34ZpwZJaCP0WBBjTA/A/7dEKQ/q+NDc9loennvgGmUKkIgHsrZv HPBA== X-Gm-Message-State: AKwxytebcZJ7Fd6g3t8UTWzBmBiym8twkkaFK5A9Q5onDHLIg4bQRvT5 JBKHPIbgzC7nm+f+0LS09GvR+OFa4EEz9KR5aooiDy29 X-Received: by 10.80.218.201 with SMTP id s9mr46393990edj.273.1517220747117; Mon, 29 Jan 2018 02:12:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.132.232 with HTTP; Mon, 29 Jan 2018 02:12:26 -0800 (PST) In-Reply-To: References: From: Chris Chiu Date: Mon, 29 Jan 2018 18:12:26 +0800 Message-ID: Subject: Re: r8169 take too long to complete driver initialization To: nic_swsd@realtek.com, netdev@vger.kernel.org, Linux Kernel , Linux Upstreaming Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 5, 2018 at 10:17 AM, Chris Chiu wrote: > On Wed, Dec 20, 2017 at 4:41 PM, Chris Chiu wrote: >> Hi, >> We've hit a suspend/resume issue on a Acer desktop caused by r8169 >> driver. The dmseg >> https://gist.github.com/mschiu77/b741849b5070281daaead8dfee312d1a >> shows it's still in msleep() within a mutex lock. >> After looking into the code, it's caused by the >> rtl8168ep_stop_cmac() which is waiting 100 seconds for >> rtl_ocp_tx_cond. The following dmesg states that the r8169 driver is >> loaded. >> >> [ 20.270526] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded >> >> But it takes > 100 seconds to get the following messages >> >> [ 140.400223] r8169 0000:02:00.0 (unnamed net_device) >> (uninitialized): rtl_ocp_tx_cond == 1 (loop: 2000, delay: 50). >> [ 140.413294] r8169 0000:02:00.0 eth0: RTL8168ep/8111ep at >> 0xffffb16c80db1000, f8:0f:41:ea:74:0d, XID 10200800 IRQ 46 >> [ 140.413297] r8169 0000:02:00.0 eth0: jumbo features [frames: 9200 >> bytes, tx checksumming: ko] >> >> So any trial to suspend the machine during this period would always >> get device/resource busy message then abort. Is this rtl_ocp_tx_cond >> necessary? Because the ethernet is still working and I don't see any >> problem. I don't know it should be considered normal or not. Please >> let me know if any more information required. Thanks >> >> Chris > > gentle ping, > > cheers. Hi, Just found a r8168 driver which seems to be authrized by realtek for cross comparison. I tried applying the patch to latest 4.15 kernel and the driver done it's initialization in faily short time. The patch file is here https://gist.github.com/mschiu77/fcf406e64a1a437f46cf2be643f1057d. In mainline r8169.c, the IBISR0 register need to be polled in the rtl8168ep_stop_cmac(). In the patch file, there's also the same IBISR0 polling code in Dash2DisableTx(), but it's been bypassed since the chipset maches HW_DASH_SUPPORT_TYPE_2. Per the rtl_chip_info[] in r8168_n.c, CFG_METHOD_23/27/28 are HW_DASH_SUPPORT_TYPE_2, and they happens to be the only 3 named RTL8168EP/8111EP in the rtl_chip_info[]. To find the same matches in r8169.c, RTL_GIGA_MAC_VER_49/50/51 seems share the same config. Can anyone clarify if the rtl_ocp_tx_cond() really necessary for 8168EP/8111EP? Or we can just ignore the condition check for RTL_GIGA_MAC_VER_49/50/51? Chris