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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 43184C433B4 for ; Tue, 13 Apr 2021 10:48:43 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FA1560E0B for ; Tue, 13 Apr 2021 10:48:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FA1560E0B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ipxe.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.109678.209370 (Exim 4.92) (envelope-from ) id 1lWGan-0003N5-RA; Tue, 13 Apr 2021 10:48:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 109678.209370; Tue, 13 Apr 2021 10:48:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lWGan-0003My-MI; Tue, 13 Apr 2021 10:48:25 +0000 Received: by outflank-mailman (input) for mailman id 109678; Tue, 13 Apr 2021 10:48:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lWGan-0003Mt-6T for xen-devel@lists.xenproject.org; Tue, 13 Apr 2021 10:48:25 +0000 Received: from blyat.fensystems.co.uk (unknown [54.246.183.96]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8bc39709-ae9f-4935-9dfc-dcaa86062316; Tue, 13 Apr 2021 10:48:24 +0000 (UTC) Received: from dolphin.home (unknown [IPv6:2a00:23c6:5495:5e00:72b3:d5ff:feb1:e101]) by blyat.fensystems.co.uk (Postfix) with ESMTPSA id 7678944263; Tue, 13 Apr 2021 10:48:21 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8bc39709-ae9f-4935-9dfc-dcaa86062316 Subject: Re: xen-netback hotplug-status regression bug To: paul@xen.org, Wei Liu , xen-devel@lists.xenproject.org, netdev@vger.kernel.org, Paul Durrant References: From: Michael Brown Message-ID: <58ccc3b7-9ccb-b9bf-84e7-4a023ccb5c56@ipxe.org> Date: Tue, 13 Apr 2021 11:48:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 13/04/2021 08:12, Paul Durrant wrote: >> If the frontend subsequently disconnects and reconnects (e.g. >> transitions through Closed->Initialising->Connected) then: >> >> - Nothing recreates "hotplug-status" >> >> - When the frontend re-enters Connected state, connect() sets up a >> watch on "hotplug-status" again >> >> - The callback hotplug_status_changed() is never triggered, and so the >> backend device never transitions to Connected state. > > That's not how I read it. Given that "hotplug-status" is removed by the > call to hotplug_status_changed() then the next call to connect() should > fail to register the watch and 'have_hotplug_status_watch' should be 0. > Thus backend_switch_state() should not defer the transition to > XenbusStateConnected in any subsequent interaction with the frontend. Thank you for the reply. I've tested and confirmed my initial hypothesis: the call to xenbus_watch_pathfmt() succeeds even if the node does not exist. I confirmed this with ftrace using: cd /sys/kernel/debug/tracing echo function_graph > current_tracer echo set_backend_state > set_ftrace_filter echo xenbus_watch_pathfmt >> set_ftrace_filter echo register_xenbus_watch >> set_ftrace_filter echo xenbus_dev_fatal >> set_ftrace_filter On the second time that the frontend transitions to Connected, this produced the trace: set_backend_state [xen_netback]() { register_xenbus_watch(); register_xenbus_watch(); xenbus_watch_pathfmt() { register_xenbus_watch(); } } which seems to confirm that the error path in xenbus_watch_path() is *not* taken, i.e. that the call to register_xenbus_watch() succeeded even though the node did not exist. Other observations also seem to confirm this behaviour: - Running "xenstore ls" in dom0 confirms that on the second frontend transition to Connected, the frontend state is indeed Connected (4) but the backend state remains in InitWait (2) - Running "xenstore watch /local/domain/0/backend/vif//0/hotplug-status" *before* starting the domU confirms that it is possible to create a watch on a node that does not (yet) exist, and that the watch *is* notified when the node is later created. > Are you seeing the watch successfully re-registered even though the node > does not exist? Perhaps there has been a change in xenstore behaviour? So, the TL;DR is that yes, the watch does successfully register even though the node does not exist. From a quick look through the xenstored source, it looks as though the only check on the node name is the call to is_valid_nodename(), which seems to perform a syntactic validity check only. I can't immediately find any commit that would have changed this behaviour. Thanks, Michael