Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1985664rda; Tue, 24 Oct 2023 08:58:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFn7WrgpFFUYCmwYACDiHwOIi7DwzRuYd6ZwMIMCjcGkbtbyG6UZsOSUSvFGoxyAe0M9Ecf X-Received: by 2002:a05:6a21:3b46:b0:16b:79c2:7d6e with SMTP id zy6-20020a056a213b4600b0016b79c27d6emr2755664pzb.30.1698163135525; Tue, 24 Oct 2023 08:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698163135; cv=none; d=google.com; s=arc-20160816; b=xmoNGn00pvg6waqWdq5HVFGI0yLiESrNFmJh+GKrTw/q0KzemV+Gf+ENdKtFZ9/S3h RI2OAZ4l3AqnvlR/Gvyo2Wnat7+B2uB8JYyDRCryGGO0FQF6pCaUXG5KxlRR2kJSknow qTuFCOeByeJYwLe8DIGX4egHJAx5/DHOWH2jF4FUAOwch7jGt2Zl6Igd2P0aHTwJPKHx PiyfVWx4ak2HoB5+ikxnaxgf3P3NUpijMw9LWSt2EOSiBgHZ/z0Jplev9DOJsgKLw6Sd t0mhbpgYR4O7UYnCZSCwUgbhmLVc3CxL5WU7WEmiED0axwizpjMbU2XoRBM4ebr4WCYj h63Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wPdb22R5YPROIH7SYh/uf5P+vcI3LDFENSGig/NGvSo=; fh=R7bZq2w8c5xv2AD1vfXo0jgdy9ffThbPPPFLhY5prN8=; b=u0kRyFr5ey9loyx/2luyr0MjXzYj722MlE2WlTMpFkv0o2l6zcQTqmbn8rAjGjXZbA IJJ4AmXw2DBQo3iT1JbQ7KLZkhWxr4dMq1azahWZTJ47xsNVV66OiLeR4/G+DpGTdjl3 WcFKWwrrg7FEvyB/KWFRKeK4rcT7pNzoTcwamLV50RqTWilPDz7XNaHhU/NfXyeroDHb lGwUn/GHZ8WY+qe/GsE45AEW0UYm3V3gJPjgTIFUjI0NoigtBZ7EvMJrFWDYYtKc9Qg+ Kz+uT79WaxiY0qcpNCt/f/tL1wySyg9G9olrSD0WBXVJcTgfvToqaffP4vNZOHqfngX6 eAGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c6-20020a056a00248600b006bc3f09ea09si8973476pfv.26.2023.10.24.08.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DAA7A80320F1; Tue, 24 Oct 2023 08:58:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344024AbjJXP6q (ORCPT + 99 others); Tue, 24 Oct 2023 11:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344019AbjJXP6l (ORCPT ); Tue, 24 Oct 2023 11:58:41 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 05E1B1701 for ; Tue, 24 Oct 2023 08:58:37 -0700 (PDT) Received: (qmail 461759 invoked by uid 1000); 24 Oct 2023 11:58:37 -0400 Date: Tue, 24 Oct 2023 11:58:37 -0400 From: Alan Stern To: "gregkh@linuxfoundation.org" Cc: "Li, Meng" , "linux-usb@vger.kernel.org" , "usb-storage@lists.one-eyed-alien.net" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb: storage: add shutdown function for usb storage driver Message-ID: <5107f6ca-e972-4af1-a21d-6c95778969f3@rowland.harvard.edu> References: <20231023054111.2744872-1-Meng.Li@windriver.com> <33bd0779-bfe7-4c87-8fe6-ea8455df3b6b@rowland.harvard.edu> <3fe5b43c-a5aa-4c6a-8614-03a4d9dd53e2@rowland.harvard.edu> <2023102428-zit-quickness-9b73@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2023102428-zit-quickness-9b73@gregkh> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:58:53 -0700 (PDT) On Tue, Oct 24, 2023 at 05:45:40PM +0200, gregkh@linuxfoundation.org wrote: > On Tue, Oct 24, 2023 at 11:35:19AM -0400, Alan Stern wrote: > > Okay, that's a different matter. In fact, I don't know what is supposed > > to happen during a clean reboot. > > Define "clean" :) In this case, I mean what happens when you give the "reboot" command. > reboot is a system thing that happens before the reboot syscall happens. > So which are we talking nabout here? > > > Greg, do you know? Should we take the time to disconnect all the USB > > devices during a system shutdown? > > In the past we have not. And if we switch to do so, we might get some > complaints as we would now delaying the shutdown process to be longer > than before. Yes, that's what I'm afraid of. > > What happens with non-USB disk drives? Or other removable devices? > > It would have to come from "above" in the device tree, so does the PCI > or platform bus say that they should be shut down and their child > devices? Well, the PCI layer invokes the HCD's ->shutdown callback. But the usb-storage driver and usbcore don't know this has happened, so they start logging errors because they are suddenly unable to communicate with a USB drive. Meng Li is unhappy about these error messages. Adding a shutdown callback of sorts to usb-storage allows the driver to know that it shouldn't communicate with the drive any more, which prevents the error message from appearing. That's what this patch does. But that's all it does. Basically it creates a layering violation just to prevent some error messages from showing up in the system log during a shutdown or reboot. The question is whether we want to do this at all, and if we do, shouldn't it be handled at the usbcore level rather than just within usb-storage? Alan Stern