Received: by 10.223.176.5 with SMTP id f5csp3242860wra; Thu, 1 Feb 2018 13:11:15 -0800 (PST) X-Google-Smtp-Source: AH8x226R0bAPvXkSYDheJV4KhCISys8ACuYbCniRpZgAwP2/abuwE3I4p20kR2AKl4paPfrFtyVW X-Received: by 2002:a17:902:bd4b:: with SMTP id b11-v6mr23735150plx.313.1517519475302; Thu, 01 Feb 2018 13:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517519475; cv=none; d=google.com; s=arc-20160816; b=a3VnQxZWix+oDM2lKTYOSSSU9ue+O0dVDWUWwUD0tTXo173FqmbwoH/Fci9cHCFIOo tlKIjLOua0eIxlWV6++J328HSmUYIfJu5cykETNIIZJ3Q3BhaG7tk6bqSbfws2kx2iRn bZcKsgqCaUxeAY82IX8X3U6X2P61a9BZXAKN3RpquVoukPdQiRsY6AHp7sfFT7jWXXMK mCt5CzkOdBnsxM9bitlPrhiIRbU9GSVDlnmGoiubUujZDklZ4/mkrf+oT8kxZuteTI+E kFsa//P/Fa10r9qBqp8ZFrfT+R0AmZqsvytQWWaIWY2PQf95u/q+BYtIB7k8rRK/RtNT 0CVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=EQqGeDKggSMj5rbKGhZYwcLXslmq2fY7HW+djWVy6x8=; b=SGTbVz5B+5/vwPFa5oj6I9lzmBBx2PezvUyiTj8On9BSLna5RdiVdUy1nUJGBL4e0G Xoplq4jy+RH72GHYE5iTtZccCQUW9Wp8klZu3Y5Qr3i3tJd7d5FTFnW+eiLv9/vXXZyO xAWD9Srpby0E1AfuyT4YhskJZl3HFJy6KIRduOc3AKV7HwAqDe2Z1uBQZhx/vXrQaKV/ tmU/z5OO4d/68Rmgm7jINAdLo+6X1+6A/Pvvmm09AXnEHNCIQSAmWjxufIChUk5PL2+r 9QVVRzK5HKVRRHF+1dW0Z4TZQbTcQ6QNFSH5V0n0TzB4v1yK+CE+5+cpoHF2LDda3rSE wsUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=a9Xbu5au; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si355018pfk.415.2018.02.01.13.10.23; Thu, 01 Feb 2018 13:11:15 -0800 (PST) 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=@oracle.com header.s=corp-2017-10-26 header.b=a9Xbu5au; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751736AbeBAVI7 (ORCPT + 99 others); Thu, 1 Feb 2018 16:08:59 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:59026 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbeBAVIz (ORCPT ); Thu, 1 Feb 2018 16:08:55 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w11KMBfW050188; Thu, 1 Feb 2018 21:08:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=EQqGeDKggSMj5rbKGhZYwcLXslmq2fY7HW+djWVy6x8=; b=a9Xbu5auYK9btnGJEs7eQSxqomreZ2s4VlKgaKfuOyMK3Z+f8uim2lymkCB+PsLRg8LT /ulyJOpEmvh61UJYx2DxSjjMidADJ7B+GBMt8T2y/y9Gko/i0krWv4o5WSg/Pwzca2rl zoTj8VO5ScEmStPU4DJ+5NaoZeNErgzhWLWd3cmnp0y5IAWIBsmBJmiZQLovDfKaNZ9O y+xSpM9NL4u4z4Fa6/JWUi0UUJgb1kI1qHOFbjvj0JnqXOxbQ+DLCgVVmJXNlR05+j8p dGVoHbdB16yHMaZ1PPLLS+OCASFNy7oQb+SamuCh8+DJDriyaOckMTNDLqQqrBEuyOma Cg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2fuqkfvx46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 01 Feb 2018 21:08:44 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w11L8ht5007793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2018 21:08:43 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w11L8gSN025082; Thu, 1 Feb 2018 21:08:42 GMT Received: from dhcp-burlington7-2nd-B-east-10-152-55-162.usdhcp.oraclecorp.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Feb 2018 13:08:42 -0800 Subject: Re: [PATCH] xen: fix frontend driver disconnected from xenbus on removal To: Oleksandr Andrushchenko , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: jgross@suse.com, otubo@redhat.com, Oleksandr Andrushchenko References: <1517475439-10541-1-git-send-email-andr2000@gmail.com> <1517475439-10541-2-git-send-email-andr2000@gmail.com> <3943477e-7768-ceb3-38a3-3a20cb0e3082@oracle.com> <05dc798a-852a-aca4-8098-862ee566e1d8@gmail.com> From: Boris Ostrovsky Message-ID: Date: Thu, 1 Feb 2018 16:09:25 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <05dc798a-852a-aca4-8098-862ee566e1d8@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8792 signatures=668660 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802010261 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 03:24 PM, Oleksandr Andrushchenko wrote: > > > On 02/01/2018 10:08 PM, Boris Ostrovsky wrote: >> On 02/01/2018 03:57 AM, Oleksandr Andrushchenko wrote: >>> From: Oleksandr Andrushchenko >>> >>> Current xenbus frontend driver removal flow first disconnects >>> the driver from xenbus and then calls driver's remove callback. >>> This makes it impossible for the driver to listen to backend's >>> state changes and synchronize the removal procedure. >>> >>> Fix this by removing other end XenBus watches after the >>> driver's remove callback is called. >>> >>> Signed-off-by: Oleksandr Andrushchenko >>> >>> --- >>> drivers/xen/xenbus/xenbus_probe.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/xen/xenbus/xenbus_probe.c >>> b/drivers/xen/xenbus/xenbus_probe.c >>> index 74888cacd0b0..9c63cd3f416b 100644 >>> --- a/drivers/xen/xenbus/xenbus_probe.c >>> +++ b/drivers/xen/xenbus/xenbus_probe.c >>> @@ -258,11 +258,11 @@ int xenbus_dev_remove(struct device *_dev) >>> DPRINTK("%s", dev->nodename); >>> - free_otherend_watch(dev); >>> - >>> if (drv->remove) >>> drv->remove(dev); >> >> Is it possible for the watch to fire here? > Indeed. Yes, It is possible, so we have to somehow protect the removed > driver from being called, e.g. the driver cleans up in its .remove, > but watch may still trigger .otherend_changed callback. > Is this what you mean? (-David who is not at Citrix anymore) Exactly. That's why otherend cleanup is split into free_otherend_watch() and free_otherend_details(). > If so, do you have something neat on your mind how to solve this? Not necessarily "neat" but perhaps you can use xenbus_read_otherend_details() in both front and back ends. After all, IIUIC you are doing something synchronously so you don't really need a watch. -boris > >> -boris >> >>> + free_otherend_watch(dev); >>> + >>> free_otherend_details(dev); >>> xenbus_switch_state(dev, XenbusStateClosed); > Thank you, > Oleksandr