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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 A4871C433E9 for ; Mon, 8 Mar 2021 18:12:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4FC9C65230 for ; Mon, 8 Mar 2021 18:12:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FC9C65230 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJKN2-0008Vi-AX for qemu-devel@archiver.kernel.org; Mon, 08 Mar 2021 13:12:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJJpD-0004ad-NW for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:37:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lJJpC-0000cT-26 for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:37:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615225064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p41WGjEacJEZdK8ZYq3XjUoXvCwhJJPKYlyQ0ak6UEc=; b=eBR64wtIMSmYYihyqh0PLhcF2CMoZEQqkXfLu94kjGS8I2SsOS6ECQAYXsRTKqKV4Atcv0 JVpww4YIZWzvkQsMBGPmx4PFvj2KrfxZbfLN7sMsS47xbkjXzMiYRdEpgVh9twpfzo5bvh paCoApkLNvBKxRc8ZTm9A8ifFvUS3Q8= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-w3NxmDEqOfSUsELikXu09g-1; Mon, 08 Mar 2021 12:37:41 -0500 X-MC-Unique: w3NxmDEqOfSUsELikXu09g-1 Received: by mail-wr1-f71.google.com with SMTP id h30so5139301wrh.10 for ; Mon, 08 Mar 2021 09:37:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=p41WGjEacJEZdK8ZYq3XjUoXvCwhJJPKYlyQ0ak6UEc=; b=CVzBlQltUPj3gTti6RVZlyx/ajfHbAa/Dm9YSt/+hvNq6Oee9ibxspRW1CwNHRgR7M Ly/18VfpPx3+r2UZeLW+E6pvXe+5CvzkcQSrKvVYi2TXA7lYwuXz7UhcU5RkZNgoaReN gnq36tbbJAdTPx8wKsuJVMjyjPf/ufnV+Xad6Hvf1FvtHLXhKipQf7zUFp7IjALgTZmK raRGTeiSPDOmLLUILtyH2Y0lQmTqWxSsIbVUa1Uore1iOGHaGTbtOd8L4+15R8SgmBDH yJOwNZdftK4sZx/fxEKMslDdG4xwqIGnIySMbRLHgMdzSg10Ix8hp4sd//BqY/QgzOnM hRQw== X-Gm-Message-State: AOAM533uapsHucapsWPWgliW+Mwq9eA90FoWE5MSVMmshJm52w7DJKp4 XLGRJ6OYPsDcKF9QgxhLv+on4kxNbzwyT6cM5x3gfa33V6I2wqgpIF1fKMr8eCQA+XqBrIbXd0j QE0GqXcV4TFYYGlM= X-Received: by 2002:a1c:7ed4:: with SMTP id z203mr22293802wmc.89.1615225060146; Mon, 08 Mar 2021 09:37:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSmeB2dN1zdzZxpYGd58BfcLPchN7Pxl2J6J/U+2DLSVH+Yxp2L3UWoLJmud3lu/op6qFQJQ== X-Received: by 2002:a1c:7ed4:: with SMTP id z203mr22293783wmc.89.1615225059934; Mon, 08 Mar 2021 09:37:39 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x11sm48333wmi.3.2021.03.08.09.37.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Mar 2021 09:37:39 -0800 (PST) Subject: Re: [PATCH] xen-block: Fix removal of backend instance via xenstore To: Anthony PERARD References: <20210308143232.83388-1-anthony.perard@citrix.com> From: Paolo Bonzini Message-ID: Date: Mon, 8 Mar 2021 18:37:38 +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: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.251, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Stefano Stabellini , qemu-block@nongnu.org, Paul Durrant , qemu-devel@nongnu.org, Maxim Levitsky , Stefan Hajnoczi , xen-devel@lists.xenproject.org, Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 08/03/21 18:29, Anthony PERARD wrote: >> If nothing else works then I guess it's okay, but why can't you do the >> xen_block_drive_destroy from e.g. an unrealize callback? > > I'm not sure if that's possible. > > xen_block_device_create/xen_block_device_destroy() is supposed to be > equivalent to do those qmp commands: > blockdev-add node-name=xvdz-qcow2 driver=qcow2 file={"driver":"file","filename":"disk.qcow2","locking":"off"} > device_add id=xvdz driver=xen-disk vdev=xvdz drive=xvdz-qcow2 > > But I tried to add a call xen_block_drive_destroy from > xen_block_unrealize, but that still is called too early, it's called > before object_property_del_all() which would delete "drive" and call > release_drive() which would free the node. Can you use blockdev_mark_auto_del? Then you don't have to call xen_block_drive_destroy at all. Paolo > So, no, I don't think we can use an unrealized callback. > > I though of trying to delete the "drive" property ahead of calling > object_unparent() but I didn't figure out how to do so and it's maybe > not possible. > > So either drain_call_rcu or adding call_rcu(xen_block_drive_destroy) > seems to be the way, but since xen_block_drive_destroy uses > qmp_blockdev_del, it seems better to drain_call_rcu. > > Cheers, >