Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2995597pxa; Tue, 18 Aug 2020 03:56:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjKdKEGkNgdAXVgs2SlhcM/Aj4iGX5EPCOJ3gtSFWyskQTJ1HXXi33XMlyyguy7whoiBhT X-Received: by 2002:a17:906:600f:: with SMTP id o15mr18984497ejj.529.1597748164008; Tue, 18 Aug 2020 03:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597748164; cv=none; d=google.com; s=arc-20160816; b=UbX0pqL/cb27jvRfms9vwmW58ZsEfoxVsXIEYULV8djhhV3xUA+T6C62QU3HqnNou5 JwJEZdzvAmB754yJh52su8OTm2994ta82u7FPZn31OoqzAOyC3hRWe7quMBm8bybhykr cyKDiZ2BOSxTA/BlOVksir/hMIfQjMhuviRcYtQ8rJ3ZBEjL+3HIIUx2ZRouNOvsKc29 Ib+kXQCzZAqjoGna2dfMONy8CB4QIm9hfzaTFdsmrCel7/cWS5rq3LE3U+SyQXRp1pIC m2Pj9x+4JK2CtX9s6IC67uUDwle+t0EgEJZLn3KuG/HG3ReKc3iJjNOhpVoMDAqtWXij 43wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:ironport-sdr:ironport-sdr; bh=zBWe/lWS/XvZX+UZOb4IY8yfrSuoMEEQQAokhCnPXfE=; b=t9LoyUOYseYiqXXNCc+hPOQcVTi0RW8iU7F32B922jsV+rD4/2JwUvRneKAAQNMu/e 2Eou+mMoHfNnAMv2qJcsDdc2V9DhQ0F6KHoDjbhnQx9IJq14KhJGeyOzFaoPAZ4f6vWG XQvTql4wtkZW+YvwiJtXLltTiIQ519S/eLU/ew82JD6mqtP/+xYnSDZtEe2H/FLoNIhq 8QV15BtoDoZsnp0/H5b9Gr8zQuVKoGcwlSe8f69IEk5N1wHkmbHBPPX6sAJZPOangRt+ vSZClT8BbpvosuIVqRIsShdjcdjNUcusqSTGTl8AYKRNdaJLey9FWVZlczN7PAAESnTp N+sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si12624137edq.425.2020.08.18.03.55.39; Tue, 18 Aug 2020 03:56:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726738AbgHRKzB (ORCPT + 99 others); Tue, 18 Aug 2020 06:55:01 -0400 Received: from esa2.mentor.iphmx.com ([68.232.141.98]:2028 "EHLO esa2.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbgHRKy7 (ORCPT ); Tue, 18 Aug 2020 06:54:59 -0400 IronPort-SDR: WlyE8QrVPyGOa90CAF0uAqRrsVrjRuh/1EAcRrGW3vpckos3KO6sDmrVqJkLHxay90J6KFYv0k fNmMFDqBc7+L+DWEvWC78a1ubUp+kol8mlpoe1KdK7LYC4cjcOQPadzBBOJdCle8zagNSvSMqP cjP0/ARzBZpfGqCqFewwDgRjiPx1kOpWt6lh8Y/v/84RlBTRlXbcFAMEFc7LGGWarnrU4wGXNu c+9Xwcz4TJY8Ijenaq3aT4EEwi18+gfZTjCp2U9FV/JDo4Krvqx6yTuFwoZPMEVj2UPWGHvEXp YY8= X-IronPort-AV: E=Sophos;i="5.76,327,1592899200"; d="scan'208";a="52035206" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 18 Aug 2020 02:54:57 -0800 IronPort-SDR: l6vG8IyywSfuGOUGMYKwnlSW55Izkbe8QU9xRXxWDhtrwhYh+vp6bo/gtoZ0S8YTOkXPPlESvD H1tLMeBNgHyyYbGTX+XKVXC3yZ68tUeDl1Pj2cOd5Ps4KDfU/38v01HbPF8nLzROeZihWyeLHG ocNLR8tw9hxU/QUduVhqaTXdyeBBBHFWNXqfCSpdllgjfmdo7fLpplJITtWrhOhsP04j2ImFt3 4V/Hy+5RVt0IBikNv/FAqwBBDNRTt13njv62t6SjMPYEfvELZfr5ZEPFGNPYFhqWwDku0rpYSg XEc= From: Jim Baxter Subject: Re: PROBLEM: Long Workqueue delays. To: Alan Stern CC: Greg KH , , , , "Resch Carsten (CM/ESO6)" , "Rosca, Eugeniu (ADITG/ESB)" References: <71aafe68-7fe0-6b77-ea8e-83edd3f16c8d@mentor.com> <20200817115744.GA3985908@kroah.com> <57a7841d-86e3-b6df-1488-a252a68a9ee0@mentor.com> <20200817184753.GA120209@rowland.harvard.edu> Message-ID: <1838f2c3-7915-9e5b-3112-6b082b945410@mentor.com> Date: Tue, 18 Aug 2020 11:54:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200817184753.GA120209@rowland.harvard.edu> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/08/2020 19:47, Alan Stern wrote: > > Unplugging a R/W USB drive without unmounting it first is a great way to > corrupt the data. > Thank you, post development we will only mount the USB stick as R/O. >> Using perf Iidentified the hub_events workqueue was spending a lot of time in >> invalidate_partition(), I have included a cut down the captured data from perf in >> [2] which shows the additional functions where the kworker spends most of its time. > > invalidate_partition() is part of the block layer, not part of USB. It > gets called whenever a drive is removed from the system, no matter what > type of drive it is. You should ask the people involved in that > subsystem why it takes so long. > I included the linux-mm list but missed the filesystem, I will ask the question to the linux-fsdevel too. >> I realise that not unmounting the USB stick is not ideal, though I wonder what >> additional work is done when unplugging the USB stick compared to unmounting it. > > Unmounting a drive flushes all the dirty buffers from memory back to the > drive. Obviously that can't be done if the drive is unplugged first. > > As far as the USB subsystem is concerned, exactly the same amount of > work is done during disconnect regardless of whether or not the drive is > mounted. (In fact, the USB subsystem doesn't even know whether a drive > is mounted; that concept is part of the block and filesystem layers.) >>> I guess it may be waiting for a time-out during the operation without the unmount. > > That seems very unlikely. When a USB device gets unplugged the system > realizes it. Any I/O meant for that device is immediately cancelled; > there are no timeouts. > > (Okay, not strictly true; there is a fraction-of-a-second timeout during > which the system waits to see whether the disconnect was permanent or > just a temporary glitch. But you're talking about 6-second long > delays.) > Thank you, no I don't expect that to cause the issue and it is very likely the delay is in another subsystem. Regards, Jim Baxter > Alan Stern >