linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Parri <parri.andrea@gmail.com>
To: Dexuan Cui <decui@microsoft.com>
Cc: vkuznets <vkuznets@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	Sasha Levin <sashal@kernel.org>,
	Michael Kelley <mikelley@microsoft.com>
Subject: Re: [PATCH 1/2] Drivers: hv: vmbus: Introduce table of VMBus protocol versions
Date: Wed, 9 Oct 2019 11:54:23 +0200	[thread overview]
Message-ID: <20191009095423.GA9510@andrea.guest.corp.microsoft.com> (raw)
In-Reply-To: <PU1P153MB0169B3B15DB8D220F8E1A728BF9A0@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM>

On Tue, Oct 08, 2019 at 10:41:42PM +0000, Dexuan Cui wrote:
> > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > Sent: Tuesday, October 8, 2019 6:00 AM
> >  ...
> > > Looking at the uses of VERSION_INVAL, I find one remaining occurrence
> > > of this macro in vmbus_bus_resume(), which does:
> > >
> > > 	if (vmbus_proto_version == VERSION_INVAL ||
> > > 	    vmbus_proto_version == 0) {
> > > 		...
> > > 	}
> > >
> > > TBH I'm looking at vmbus_bus_resume() and vmbus_bus_suspend() for the
> > > first time and I'm not sure about how to change such check yet... any
> > > suggestions?
> > 
> > Hm, I don't think vmbus_proto_version can ever become == VERSION_INVAL
> > if we rewrite the code the way you suggest, right? So you'll reduce this
> > to 'if (!vmbus_proto_version)' meaning we haven't negotiated any version
> > (yet).
> 
> Yeah, Vitaly is correct. The check may be a little paranoid as I believe 
> "vmbus_proto_version" must be a negotiated value in vmbus_bus_resume()
> and vmbus_bus_suspend().  I added the check just in case.
> 
> > > Mmh, I see that vmbus_bus_resume() and vmbus_bus_suspend() can access
> > > vmbus_connection.conn_state: can such accesses race with a concurrent
> > > vmbus_connect()?
> > 
> > Let's summon Dexuan who's the author! :-)
> 
> There should not be an issue:
> 
> vmbus_connect() is called in the early subsys_initcall(hv_acpi_init).
> 
> vmbus_bus_suspend() is called late in the PM code after the kernel boots up, e.g.
> in the hibernation function hibernation_snapshot() -> dpm_suspend(). 
> 
> vmbus_bus_resume() is also called later in late_initcall_sync(software_resume).
> 
> In the hibernatin process, vmbus_bus_suspend()/resume() can also be called a
> few times, and vmbus_bus_resume() calls vmbus_negotiate_version(). As I
> checked, there is no issue, either.

Thank you both for these remarks.

So, I'll proceed with the removal of VERSION_INVAL in v2 of this series.

Thanks,
  Andrea

  reply	other threads:[~2019-10-09  9:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 16:31 [PATCH 0/2] Drivers: hv: vmbus: Miscellaneous improvements Andrea Parri
2019-10-07 16:31 ` [PATCH 1/2] Drivers: hv: vmbus: Introduce table of VMBus protocol versions Andrea Parri
2019-10-07 17:14   ` Vitaly Kuznetsov
2019-10-08 12:41     ` Andrea Parri
2019-10-08 12:44       ` Andrea Parri
2019-10-08 13:00       ` Vitaly Kuznetsov
2019-10-08 22:41         ` Dexuan Cui
2019-10-09  9:54           ` Andrea Parri [this message]
2019-10-07 17:25   ` Dexuan Cui
2019-10-08 12:42     ` Andrea Parri
2019-10-07 16:31 ` [PATCH 2/2] Drivers: hv: vmbus: Enable VMBus protocol versions 5.1 and 5.2 Andrea Parri
2019-10-07 17:41 ` [PATCH 0/2] Drivers: hv: vmbus: Miscellaneous improvements Dexuan Cui
2019-10-08 15:08   ` Andrea Parri
2019-10-08 19:47     ` Vitaly Kuznetsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191009095423.GA9510@andrea.guest.corp.microsoft.com \
    --to=parri.andrea@gmail.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=sashal@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).