Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp704189ybp; Wed, 9 Oct 2019 02:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHZnTy2zSrxidFTgugEZ9NjF8yW1H7rkjSRf5lUwGm9V1YxNGEkENPpeyvhjsYV2iIK9fr X-Received: by 2002:a50:ace1:: with SMTP id x88mr2135843edc.132.1570615083002; Wed, 09 Oct 2019 02:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570615082; cv=none; d=google.com; s=arc-20160816; b=pxcW/gpMzf60KuplHD8vfIUvzqbugqvtERhcqwWMpXkO10uwEjeCYNXqtulLDHNJ8N dgeolUApAEY0bNG6bd06iiLxdLR1FZn2f9g3puqMOUdu/IWoaUER2XcqfmWXpcMcpzSL aD/nuRkMjthy3WZFQMXnwEKEo4t+ASu4Rmpe7EK9NwMQv8rAElsOQoRZqndwPb/fnR3c riP5pkNbJJ5plKdpLWogEBlkHXXin9Gf/XIuXriYeBd5PM0WsZrCkxfB1mPNuufmkFES MnJaV0wGFbKu0ub0VbhCXqocuJwA8OX3Rer8AHEMP6Oq46Yoir1MtuuDUJRnIVIU5TZK 3ZKw== 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:dkim-signature; bh=pjzPB8hZxTlvLEbGNCa+B9mKE/gfU2JFjpfrgoII7AM=; b=N1d1C+LxlTngBrDT9hAl2jO/yz+8ZGJil+A6gIGbdsu4hU9qlgxjiDymuBobxhSGot P38114qSbmGqxMIT4P6m0T58CB/0Iayx669/uCs8AUGqpNisLG5jWi8BJQd1vcBcVlF3 o2AjUBYlH7X7j3N9qXlK2xkCH+bGa1HW4eqRMHf1Zp2fcoqXnhn5I06cjyh6+FRdkB/i xLxfRnDcmwBMJDfVO54Ywaw4k+vnTpLb4iLxcf376b3bIDiy8V53xTcuXWHHnZWSchlM y/14KJCstCKdH60/CcJQgYMGQTFVdgquIGolQMx5osisBp0vvHoSZ9/IfowYGycyoIpo Rsag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ghGng6jv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v27si820799ejb.182.2019.10.09.02.57.38; Wed, 09 Oct 2019 02:58:02 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ghGng6jv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730533AbfJIJyc (ORCPT + 99 others); Wed, 9 Oct 2019 05:54:32 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52339 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfJIJyc (ORCPT ); Wed, 9 Oct 2019 05:54:32 -0400 Received: by mail-wm1-f68.google.com with SMTP id r19so1747161wmh.2; Wed, 09 Oct 2019 02:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pjzPB8hZxTlvLEbGNCa+B9mKE/gfU2JFjpfrgoII7AM=; b=ghGng6jvRuyoU5VrK0M9LvMWPWhWdUWwRxombiYF7h7LD50JfxHYeWYouqmkjHJz09 g9dlBr51y5GlMYcXM4xu50W/QQc79U4pFR4liuW4rMqWKAf/oaJppWvy0IwpZotfgGDe OozCn6XAOtih00mC5qmCslTQe6qatrfpHQfmb+4VAplOwofiEuFTMnDBVj6vvkPyiyGQ lsUMvgMkhUWDfp5fuaRvqFSu6rKqM0S6KlFWKPQ7nWUX81uOGAMcM8uy9kgBKfD4dClC Eo1tKxNNeGqFNKK/eEow2mEJHXeMyRlGpuYq6XI1hPLJuFiVVKBZD2/7uwz65znyPb1s cM+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pjzPB8hZxTlvLEbGNCa+B9mKE/gfU2JFjpfrgoII7AM=; b=aRxguDB7jCz+fFF7E94GbXRi1LAk9KCJmi1kmGpZkcNA9Ggby8AK0JVnt05D6D2pQQ GTfdY2Eh5WBHu574HukpUFk3Iic8wQrBaxc3uHiwWltzr8tkOvzaEMObehWevD+kWJF0 XnVIoc0OVLyGg1oQpwkSW5H2HUgh+18xMVXgYnmDLWOQ8B8CM0f6XVbJAJ2gQ6BrcPkF JUsotzfFHzK/wQneyT5OJYdUkPOU1vwUvtFnKb2/nUMAHlArUSs+ui6kFqRskhJp4SFE 0JRkLzv2P0FqznhWeGUoRpuEWB1VkNagm7ihARfdWs4NPAbj0D+pW7x3maoRqb4AHXFT 3F/A== X-Gm-Message-State: APjAAAWR9BLFNecSfvYzFy6BeOljtU8mA1b4l3hY75eispAVIb4aWdPV GRH/iB6B06BL/w6rGzbeiRk= X-Received: by 2002:a1c:5587:: with SMTP id j129mr1915601wmb.15.1570614869657; Wed, 09 Oct 2019 02:54:29 -0700 (PDT) Received: from andrea.guest.corp.microsoft.com ([2a01:110:8012:1012:e0c:643a:f61b:5721]) by smtp.gmail.com with ESMTPSA id a3sm3065408wmc.3.2019.10.09.02.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 02:54:29 -0700 (PDT) Date: Wed, 9 Oct 2019 11:54:23 +0200 From: Andrea Parri To: Dexuan Cui Cc: vkuznets , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Michael Kelley Subject: Re: [PATCH 1/2] Drivers: hv: vmbus: Introduce table of VMBus protocol versions Message-ID: <20191009095423.GA9510@andrea.guest.corp.microsoft.com> References: <20191007163115.26197-1-parri.andrea@gmail.com> <20191007163115.26197-2-parri.andrea@gmail.com> <87eezo1nrr.fsf@vitty.brq.redhat.com> <20191008124052.GA11245@andrea.guest.corp.microsoft.com> <87zhibz91y.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 08, 2019 at 10:41:42PM +0000, Dexuan Cui wrote: > > From: Vitaly Kuznetsov > > 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