Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3124718ybc; Thu, 21 Nov 2019 03:46:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwiIvVwsfrQVffNdI1KP4oxm3qKsfpFKSn3VFToSHLvxehNHtGcezRFtft8LDYVd+pzPN8R X-Received: by 2002:a17:906:5211:: with SMTP id g17mr13568015ejm.60.1574336797249; Thu, 21 Nov 2019 03:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574336797; cv=none; d=google.com; s=arc-20160816; b=ecB00t+Y4ne5iMVqnDsNhRV0LksDXieS/UkeW2ZqR+dREI8JN3+6y1yzgdyvb1x7/1 zRRvy57Xk0zxNXqNXmoC7WrWDa8/Wi7P63SRbNmqzKGRDgeH7/R3oSfw2/zh1unlF0SN fNXSCaTgkDVOfBA+lOyzjosL/vw5ma8Wvl23V+8vpsk06kfNbAnW8R3egn9u33eW/AXf sjrjFo4jgUKqmY/kyuPjRABRgxY0UFVpa7PJ7b7wdBVZNjm0vOrrnu8+8LIkonMEIiu5 IVYm67yX31hhzIfFOnNk7ANJxDd6azC/46gXngQZ533bBBmJ6s2g2Kpr27uz2GK+tOGV j+iA== 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:message-id:subject:cc :to:from:date; bh=pH7Ku7wklnkoYFzbJ2DNKR5XB/6SPCt9fWo7DrC2aV0=; b=LtHct78FQSMLvJWe9mqiLJ5fd3+LxyHWhxKULgSgON5RsMBlLNZhZIWX782xom+fSG AGXTwbjdkUgiWpDh5/DCvcGISvu9CjV0d25Mk9wNvncBuAHc3AAwMdPOr0mjQtUWvuxw XBU8xq4yybQgQzfGJMHt3e0oWtDS9vbiT/LnL/YkZVwPuqUmQyCNmJP9tnroLUuPeEjI 3c9Jqvyn1OZRuvs9gMuYd6X41N9QLANwWoL+HFOrz9ytoMn+GspsF6hs0EbSPfer/9YP Fi8DftPrbh3XF1k+llQnkSmhI6Q5dH2fz9zQJkRcgfMczRuaylghixke3kAqjeago8XM n5OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn24si576572ejb.333.2019.11.21.03.46.13; Thu, 21 Nov 2019 03:46:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726546AbfKULo1 (ORCPT + 99 others); Thu, 21 Nov 2019 06:44:27 -0500 Received: from foss.arm.com ([217.140.110.172]:54866 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbfKULo1 (ORCPT ); Thu, 21 Nov 2019 06:44:27 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 70368328; Thu, 21 Nov 2019 03:44:26 -0800 (PST) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0032F3F703; Thu, 21 Nov 2019 03:44:24 -0800 (PST) Date: Thu, 21 Nov 2019 11:44:19 +0000 From: Lorenzo Pieralisi To: Dexuan Cui Cc: KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "sashal@kernel.org" , "bhelgaas@google.com" , "linux-hyperv@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Michael Kelley , Sasha Levin Subject: Re: [PATCH v2 2/4] PCI: hv: Add the support of hibernation Message-ID: <20191121114419.GA4318@e121166-lin.cambridge.arm.com> References: <1574234218-49195-1-git-send-email-decui@microsoft.com> <1574234218-49195-3-git-send-email-decui@microsoft.com> <20191120172026.GE3279@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Nov 21, 2019 at 12:50:17AM +0000, Dexuan Cui wrote: > > From: Lorenzo Pieralisi > > Sent: Wednesday, November 20, 2019 9:20 AM > > > > On Tue, Nov 19, 2019 at 11:16:56PM -0800, Dexuan Cui wrote: > > > Implement the suspend/resume callbacks. > > > > > > We must make sure there is no pending work items before we call > > > vmbus_close(). > > > > Where ? Why ? Imagine a developer reading this log to try to understand > > why you made this change, do you really think this commit log is > > informative in its current form ? > > > > I am not asking a book but this is a significant feature please make > > an effort to explain it (I can update the log for you but please > > write one and I shall do it). > > > > Lorenzo > > Sorry for being sloppy on this patch's changelog! Can you please use the > below? I can also post v3 with the new changelog if that's better. As you wish but more importantly get hyper-V maintainers to ACK these changes since time is running out for v5.5. Lorenzo > PCI: hv: Add the support of hibernation > > hv_pci_suspend() runs in a process context as a callback in dpm_suspend(). > When it starts to run, the channel callback hv_pci_onchannelcallback(), > which runs in a tasklet context, can be still running concurrently and > scheduling new work items onto hbus->wq in hv_pci_devices_present() and > hv_pci_eject_device(), and the work item handlers can access the vmbus > channel, which can be being closed by hv_pci_suspend(), e.g. the work item > handler pci_devices_present_work() -> new_pcichild_device() writes to > the vmbus channel. > > To eliminate the race, hv_pci_suspend() disables the channel callback > tasklet, sets hbus->state to hv_pcibus_removing, and re-enables the tasklet. > > This way, when hv_pci_suspend() proceeds, it knows that no new work item > can be scheduled, and then it flushes hbus->wq and safely closes the vmbus > channel. > > Thanks, > -- Dexuan