From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4EA4C433E3 for ; Mon, 17 Aug 2020 11:57:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 907EE2072E for ; Mon, 17 Aug 2020 11:57:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xvCAEQt7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 907EE2072E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 25A358D0002; Mon, 17 Aug 2020 07:57:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 20A7C6B0006; Mon, 17 Aug 2020 07:57:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 120D38D0002; Mon, 17 Aug 2020 07:57:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id F0A3F6B0005 for ; Mon, 17 Aug 2020 07:57:26 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A460C3653 for ; Mon, 17 Aug 2020 11:57:26 +0000 (UTC) X-FDA: 77159910492.15.neck34_0f095c227016 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 709B21814B0C1 for ; Mon, 17 Aug 2020 11:57:26 +0000 (UTC) X-HE-Tag: neck34_0f095c227016 X-Filterd-Recvd-Size: 2975 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Aug 2020 11:57:25 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81FA1204EA; Mon, 17 Aug 2020 11:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597665445; bh=WlpyWk2CigbIwSvUvCGB3jBf0Ifuv83GLdABZeilG9I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xvCAEQt7XuRhAa959zo5CVsMnypZOd8mFKK5XD9d+i9uFdBaPVgKy+mVnyhQixtWN QTm+l5gT1UjH2su3kPMB4xFcnQB+CQifQVoY+7sNvADHd6xJ7vE0vWn6/4HwWz2S4O LMBh1EIhEsg09SBQQdqsgmLqcqjhvl7Bo04s/nak= Date: Mon, 17 Aug 2020 13:57:44 +0200 From: Greg KH To: Jim Baxter Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-usb@vger.kernel.org, "Resch Carsten (CM/ESO6)" , "Rosca, Eugeniu (ADITG/ESB)" Subject: Re: PROBLEM: Long Workqueue delays. Message-ID: <20200817115744.GA3985908@kroah.com> References: <71aafe68-7fe0-6b77-ea8e-83edd3f16c8d@mentor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71aafe68-7fe0-6b77-ea8e-83edd3f16c8d@mentor.com> X-Rspamd-Queue-Id: 709B21814B0C1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Aug 17, 2020 at 12:40:03PM +0100, Jim Baxter wrote: > We have issues with the workqueue of the kernel overloading the CPU 0 > when we we disconnect a USB stick. > > This results in other items on the shared workqueue being delayed by > around 6.5 seconds with a default kernel configuration and 2.3 seconds > on a config tailored for our RCar embedded platform. > > I am aware there will be delays on the shared workqueue, are the delays > we are seeing considered normal? > > > > We first noticed this issue on custom hardware and we have recreated it > on an RCar Starter Kit using a test module [1] to replicate the > behaviour, the test module outputs any delays of greater then 9ms. > > To run the test we have a 4GB random file on a USB stick and perform > the following test: > > > - Load the Module: > # taskset -c 0 modprobe latency-mon > > - Copy large amount of data from the stick: > # dd if=/run/media/sda1/sample.txt of=/dev/zero > [ 1437.517603] DELAY: 10 > 8388607+1 records in > 8388607+1 records out > Is this data really flushed out to the device? > - Disconnect the USB stick: > [ 1551.796792] usb 2-1: USB disconnect, device number 2 > [ 1558.625517] DELAY: 6782 > > > The Delay output 6782 is in milliseconds. What USB workqueue is taking so long? The one trying to deal with the filesystem flushing out the data that it can't do now that the device is removed? :) thanks, greg k-h