Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp868276ybz; Wed, 22 Apr 2020 09:20:56 -0700 (PDT) X-Google-Smtp-Source: APiQypLi7wWSNGAtYpo9pIivea9ND1Ys5M4+tDGVW3ZRZLWHknfScoWVg+8+UiVBJFTesxpC+E5+ X-Received: by 2002:a05:6402:1651:: with SMTP id s17mr11516107edx.173.1587572456378; Wed, 22 Apr 2020 09:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587572456; cv=none; d=google.com; s=arc-20160816; b=cA3QcIhIy8pZjpuvPRANXKNKZlpgHdUwbhasxt95Oo/qOOuZNxno25Kqg7zgPhzMUA naRtn7e+zvZMLQqg5HE1FnNLXslh2oP6/j2+8Dfl4yahDdOwjDWIAtKBxD1RMKelpPVw zBHPN8I/8TbHrbd8njWMjPB8Uo114ibZvszmL1rp9LhW6E1P5dDqbkss6/WkQOxFs1BH 1GTilZvGArFar0X+lW5EF7CKJWZLPEybqSi1PCXj9bbTJf+wscnnvUh73Uk94Zaz6pXv ky+qpEdGZTEQsjmtyVCwRyS+RCjptIhL0dVZHUOKVeyP2Ea1ImFX+kPR5R1teaPrXBcG lqIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ghahd9jfdIlYskqXdtpRbtQzcXyC3BwcOCP7kMcrh7A=; b=i0pTjM+MQhTr4mrVjPLM/YW5BrBvC5UU7iW+zByDiexoWC4pUF1bbD+8zRe2ps+iPQ KT11EuVT2rEpt7CohycDm1F9mnJXyiW0+C0BGfPR7VowKCHdug2FsHPk2i9bGoqYO02C u5QDqAlBoLooyVwGsQaTnUgiIigJHK6vwCoS8FygzLhG09trEF9CVmY6aoZIdYywti5g 1LjnBXoK2pUHl3OcUer0jQVt/8gQ6gdEfk+j2TBDckthNRfHnbzmi8MEttZs3DPaL9Hi 2hP6LyeoY8DkIRnvGD0GsIbgSNk2vdJIcudZAeRnpI/Y1p3jewPjxULxMl1A8kR3entW kLJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=swTEzOz7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd11si3535068ejb.435.2020.04.22.09.20.29; Wed, 22 Apr 2020 09:20:56 -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; dkim=pass header.i=@kernel.org header.s=default header.b=swTEzOz7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbgDVQTQ (ORCPT + 99 others); Wed, 22 Apr 2020 12:19:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:39054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgDVQTO (ORCPT ); Wed, 22 Apr 2020 12:19:14 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (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 977F62076E; Wed, 22 Apr 2020 16:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587572353; bh=/ju+Nf/ZeNdIEbRhaDpQGOzeSE/IYkIJF4a7nzgxgRU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=swTEzOz7sfsOyPVId/9RaCJV/xkD3qVt8/D9P/cBDFB4zMtb6LS+Ck+gJqjXzUaaC hhALIp4sjV67d39Ki8rx9dX+lZRSjZreP3pGo+Hycp0pYIjPUXe2jCrRyqz863lInd yY4dC+ggXikcZtEvFN3zIf5ZeBhB9S7CKBcK02Dw= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 7C46D35203BC; Wed, 22 Apr 2020 09:19:13 -0700 (PDT) Date: Wed, 22 Apr 2020 09:19:13 -0700 From: "Paul E. McKenney" To: Ming Lei Cc: Dexuan Cui , Josh Triplett , "Rafael J. Wysocki" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "hch@lst.de" , "bvanassche@acm.org" , "hare@suse.de" , Michael Kelley , Long Li , "linux-hyperv@vger.kernel.org" , "wei.liu@kernel.org" , Stephen Hemminger , Haiyang Zhang , KY Srinivasan , "linux-pm@vger.kernel.org" Subject: Re: [PATCH] scsi: storvsc: Fix a panic in the hibernation procedure Message-ID: <20200422161913.GX17661@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <1587514644-47058-1-git-send-email-decui@microsoft.com> <20200422012814.GB299948@T590> <20200422020134.GC299948@T590> <20200422030807.GK17661@paulmck-ThinkPad-P72> <20200422041629.GE299948@T590> <20200422092351.GF299948@T590> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422092351.GF299948@T590> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 05:23:51PM +0800, Ming Lei wrote: > On Wed, Apr 22, 2020 at 04:58:14AM +0000, Dexuan Cui wrote: > > > From: Ming Lei > > > Sent: Tuesday, April 21, 2020 9:16 PM > > > ... > > > > > > When we're in storvsc_suspend(), all the userspace processes have been > > > > > > frozen and all the file systems have been flushed, and there should not > > > > > > be too much I/O from the kernel space, so IMO scsi_host_block() should > > > be > > > > > > pretty fast here. > > > > > > > > > > I guess it depends on RCU's implementation, so CC RCU guys. > > > > > > > > > > Hello Paul & Josh, > > > > > > > > > > Could you clarify that if sysnchronize_rcu becomes quickly during > > > > > system suspend? > > > > > > > > Once you have all but one CPU offlined, it becomes extremely fast, as > > > > in roughly a no-op (which is an idea of Josh's from back in the day). > > > > But if there is more than one CPU online, then synchronize_rcu() still > > > > takes on the order of several to several tens of jiffies. > > > > > > > > So, yes, in some portions of system suspend, synchronize_rcu() becomes > > > > very fast indeed. > > > > > > Hi Paul, > > > > > > Thanks for your clarification. > > > > > > In system suspend path, device is suspended before > > > suspend_disable_secondary_cpus(), > > > so I guess synchronize_rcu() is not quick enough even though user space > > > processes and some kernel threads are frozen. > > > > > > Thanks, > > > Ming > > > > storvsc_suspend() -> scsi_host_block() is only called in the hibernation > > path, which is not a hot path at all, so IMHO we don't really care if it > > takes 10ms or 100ms or even 1s. :-) BTW, in my test, typically the > > Are you sure the 'we' can cover all users? > > > scsi_host_block() here takes about 3ms in my 40-vCPU VM. > > If more LUNs are added, the time should be increased proportionallly, > that is why I think scsi_host_block() is bad. If the caller must wait until the grace period ends, then the traditional approach is to use a single synchronize_rcu() to cover all LUNs. This of course can require some reworking of the code. If the caller does not need to wait, then either call_rcu() or kfree_rcu() can work quite well. Thanx, Paul