Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp782324lqj; Sun, 2 Jun 2024 23:43:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjb4VoBipOo1onVr00NO8kCOy1QO3Or62mf7TsAcqGExZbLlUP5MhvALpAdh8IziabxpivnQlue5HUA4lKwvfyCxn+XXKppNaYL+YCqA== X-Google-Smtp-Source: AGHT+IHQOul3MqGyOSoG+G/LG0fDWKMwik9ozN/G3nZuhpJxakLw9iAR9h6aRYZ5Ayjovse6JA54 X-Received: by 2002:a17:90b:e84:b0:2c1:a6e1:6a7 with SMTP id 98e67ed59e1d1-2c1dc5c8af6mr6983066a91.31.1717397016842; Sun, 02 Jun 2024 23:43:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717397016; cv=pass; d=google.com; s=arc-20160816; b=HMzBkACJOKvUDi5DAL2hOVtbiw774CdelutZHDQGHicEk0n5I8SZ+mnIf+7zFVbo5M ZZtA6KLX5nYlYelDdmNq72aFkTegJ7sMpYu15zPOfuCMG2cpL7ePGXctPyS6BBJ6SfWZ oQP3Q/yBMhE0db2b9jG0N6S42ayLkwnWpqCTjEb7IyMlW8ulPtEt7kezKF/E6tc3NQkv 2Clv63vdG/vb0+Dj8Xz9IPmSWrHMf5W2CosfASwb9W1fABA04K7QJeGTKGCOj761YCVm KMxPZyLZDv3rX9V3uG7f2DJ3om8Il84jkejwbIcyIB00mrk1PWXkuFfC46A3qv5iSzz0 jFRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=ZpTAvN6hUerwIfZ9CtWKHnQuSfPH3c/DikGOy5+AIjg=; fh=ZB9vzP+v6q+uU/oKbgcfk/BgaZD3BsaJROEWkKqgkK4=; b=hhuQ4pFnnRVwsIj3U6TnEjsNTRlaOxpOgkD9Na0J1FG5lXTFOWVgegqxNzSwRgpVJC fUFVxPlvzFfnxhcOJVpdLeWKEfz4X1dwm17rbzyU4xltmLc0K15+p3mYlCTzM5RE7Pjg xT2j8L/aGbdHYr6cKngwvVYLKOPJ9ABfBYzhcs0YqqqHizxegxXTIy8z7Kw92r3KakAl q9/qWvfsMh4bvZp7DvMxR7l8X8jN0EQ0fTFpuMkgSjzEWtJcvQjq/kERrlpllzXWcEUG bYWtzMpVgDcrVMhuGeG7S6HLWsEa/oEMXltXABBQpLuOQy7PTjNiMjTfT2ho+f9rEmPS hCNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-198659-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198659-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1c2852025si6023439a91.184.2024.06.02.23.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 23:43:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198659-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-kernel+bounces-198659-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198659-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4192FB223E7 for ; Mon, 3 Jun 2024 06:41:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72E775A0F4; Mon, 3 Jun 2024 06:39:37 +0000 (UTC) Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5F5039FE5; Mon, 3 Jun 2024 06:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717396776; cv=none; b=mZ3zalrvab12V/uqymOuuXSsgD0EIVxdwglVZDxXBQwsAYh1ueE05DSt8dLG/k9xUA06o+ty4o12AwC6wkZmbK9iT+BOPzzENu4cugy5Qqh01q/djG9wg1BWmGo3F2gbKIGJzQZRR2DTkMiZrN4lNV6b40e42U1PSd0xbtlGtrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717396776; c=relaxed/simple; bh=ZpTAvN6hUerwIfZ9CtWKHnQuSfPH3c/DikGOy5+AIjg=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=Oh4ByXzz9fVkm+fMF8y1/8T4k3Ps3nOmTSvFVESvVIT5dzmAVQujj5uhOExJyOoaVsELLU9n/xIAXCOK56FUUCLHuNyNm2hXB6adfG3JefVrgy9xo2uPI/B5ssk8KR53PrKDVK47QtuKUZZJ1m/nqEpYMJSPvCKF5JTSkp1fRS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4536d2vO52498792, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 4536d2vO52498792 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2024 14:39:02 +0800 Received: from RTEXMBS03.realtek.com.tw (172.21.6.96) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 3 Jun 2024 14:39:03 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS03.realtek.com.tw (172.21.6.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 3 Jun 2024 14:39:02 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::1a1:9ae3:e313:52e7]) by RTEXMBS04.realtek.com.tw ([fe80::1a1:9ae3:e313:52e7%5]) with mapi id 15.01.2507.035; Mon, 3 Jun 2024 14:39:02 +0800 From: Hayes Wang To: Douglas Anderson , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: "danielgeorgem@google.com" , Andrew Lunn , Grant Grundler , Heiner Kallweit , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" Subject: RE: [PATCH REPOST net-next 1/2] r8152: If inaccessible at resume time, issue a reset Thread-Topic: [PATCH REPOST net-next 1/2] r8152: If inaccessible at resume time, issue a reset Thread-Index: AQHasuswBg+aoM1vbkGYnO9BBos/N7G1mwVQ Date: Mon, 3 Jun 2024 06:39:02 +0000 Message-ID: References: <66590f22.170a0220.8b5ad.1750@mx.google.com> In-Reply-To: <66590f22.170a0220.8b5ad.1750@mx.google.com> Accept-Language: zh-TW, en-US Content-Language: zh-TW x-kse-serverinfo: RTEXMBS03.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback Douglas Anderson > Sent: Friday, May 31, 2024 7:43 AM [...] > If we happened to get a USB transfer error during the transition to > suspend then the usb_queue_reset_device() that r8152_control_msg() > calls will get dropped on the floor. This is because > usb_lock_device_for_reset() (which usb_queue_reset_device() uses) > silently fails if it's called when a device is suspended or if too > much time passes. >=20 > Let's resolve this by resetting the device ourselves in r8152's > resume() function. >=20 > NOTE: due to timing, it's _possible_ that we could end up with two USB > resets: the one queued previously and the one called from the resume() > patch. This didn't happen in test cases I ran, though it's conceivably > possible. We can't easily know if this happened since > usb_queue_reset_device() can just silently drop the reset request. In > any case, it's not expected that this is a problem since the two > resets can't run at the same time (because of the device lock) and it > should be OK to reset the device twice. If somehow the double-reset > causes problems we could prevent resets from being queued up while > suspend is running. >=20 > Signed-off-by: Douglas Anderson Acked-by: Hayes Wang Best Regards, Hayes