From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92ABBC4332F for ; Sun, 12 Nov 2023 20:38:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2HD4-00026a-H5; Sun, 12 Nov 2023 15:37:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2HD3-00026S-En for qemu-devel@nongnu.org; Sun, 12 Nov 2023 15:37:33 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2HD1-0003wX-Oz for qemu-devel@nongnu.org; Sun, 12 Nov 2023 15:37:33 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40806e4106dso21551155e9.1 for ; Sun, 12 Nov 2023 12:37:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699821449; x=1700426249; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=piE5yixx1rUhhuatPeS2Qkl4Lqntg8uWoigQoIXZVfM=; b=QgmMJjdbjRN4zxH+jDEOcv/KR4VmuABoyfSosWrxOFuI2OQ4Qt+VgPz9WoH4idRemy oCcD5RRQ8D+9aPeL9HLqtxJvcjnz4m/G7YdziIMz3hi5hWU6BQl1DYY1wba1rsdKlmeF tVusbltnr4beKUIRy+Z8Aoji9E7g89Q3zuQnsC/VgwPGL2cEg+mhY+xRXd1HiULk5QzS z0Fw+vnWb1DLNh/3wOU7R3kvOrWzZuCMnaOnU3vU9z5zI8CzYesLG4UHEEu5WamkrPyo jwr+ZLWDNgq2Ztylm1VZri23ixQZfQV/+wyZpiRZOmVLbKc7ZHLm2MTbi+S4jblyGGgu si2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699821449; x=1700426249; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=piE5yixx1rUhhuatPeS2Qkl4Lqntg8uWoigQoIXZVfM=; b=DaEHXz0AK9kbMpX+LRwTfj++jF+2zhtJKxPQmOB6fbdZpXbBEy6ZGZmlqe9MIYxxH2 Fvb6Q2Pm8AZo8eo1HkTMSwg/mPlyN4G8pJBfqra7i5jumLmmB3dYDgMIfR0aNpPfASi4 GW0wIR8wtBDWBO87FQ3ss037DoEvEcY55DNjyb4qfk2FmoLLc0romFEfeP5f5OpggK2r IQ4/yHF+l6XE3gEcQBNwe/rGQwtjSv98/+HAaDjOvJAFjLk5CoxBUXAVmrUJwLYLbfIU yhTVRqWWXXx2L7lwuib2iHBeqtJUtF2ZHy5avkBM2T2XKb8hD+zYEcnFBQ7aJaIDVMxM gPsw== X-Gm-Message-State: AOJu0YwU/BeXee+cQgs/R0YuS8AEeu5CCeA9/DIpRp9nYGZXUrZefYtI 3VQO4kNbkmsuRkTi1RXDK+o= X-Google-Smtp-Source: AGHT+IEuwcbyYUDhvrPtmS85IhFf5GK/mXVIP6g0nWCkiXCysRWPG1vLV3lKVXc5aU+3iV291pJu6g== X-Received: by 2002:a05:600c:1992:b0:406:51a0:17ea with SMTP id t18-20020a05600c199200b0040651a017eamr4677083wmq.10.1699821448803; Sun, 12 Nov 2023 12:37:28 -0800 (PST) Received: from [192.168.199.91] (54-240-197-234.amazon.com. [54.240.197.234]) by smtp.gmail.com with ESMTPSA id ay15-20020a05600c1e0f00b0040586360a36sm11700180wmb.17.2023.11.12.12.37.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Nov 2023 12:37:28 -0800 (PST) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <4886e994-6f4b-4d9f-97fc-9f6d7a8b3641@xen.org> Date: Sun, 12 Nov 2023 15:37:25 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 5/7] xen-bus: Set offline if backend's state is XenbusStateClosed Content-Language: en-US To: Volodymyr Babchuk , "qemu-devel@nongnu.org" Cc: Oleksandr Tyshchenko , Stefano Stabellini , Anthony Perard , "open list:X86 Xen CPUs" References: <20231110204207.2927514-1-volodymyr_babchuk@epam.com> <20231110204207.2927514-6-volodymyr_babchuk@epam.com> Organization: Xen Project In-Reply-To: <20231110204207.2927514-6-volodymyr_babchuk@epam.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=xadimgnik@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: paul@xen.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 10/11/2023 15:42, Volodymyr Babchuk wrote: > From: Oleksandr Tyshchenko > > Both state (XenbusStateClosed) and online (0) are expected by > toolstack/xl devd to completely destroy the device. But "offline" > is never being set by the backend resulting in timeout during > domain destruction, garbage in Xestore and still running Qemu > instance. > > Signed-off-by: Oleksandr Tyshchenko > Signed-off-by: Volodymyr Babchuk > --- > hw/xen/xen-bus.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c > index 75474d4b43..6e7ec3af64 100644 > --- a/hw/xen/xen-bus.c > +++ b/hw/xen/xen-bus.c > @@ -519,6 +519,10 @@ static void xen_device_backend_changed(void *opaque, const char *path) > xen_device_backend_set_state(xendev, XenbusStateClosed); > } > > + if (xen_device_backend_get_state(xendev) == XenbusStateClosed) { > + xen_device_backend_set_online(xendev, false); > + } > + > /* > * If a backend is still 'online' then we should leave it alone but, > * if a backend is not 'online', then the device is a candidate I don't understand what you're trying to do here. Just a few lines up from this hunk there is: 506 if (xen_device_backend_scanf(xendev, "online", "%u", &online) != 1) { 507 online = 0; 508 } 509 510 xen_device_backend_set_online(xendev, !!online); Why is this not sufficient? What happens if the frontend decides to stop and start (e.g. for a driver update)? I'm guessing the backend will be destroyed... which is not very friendly. Paul