Received: by 10.223.176.5 with SMTP id f5csp3202340wra; Thu, 1 Feb 2018 12:26:26 -0800 (PST) X-Google-Smtp-Source: AH8x226jSgOwbm/IROn58zm+3U9XrzfeN8W0GOer/VnF3jMUvTIFZLX5F9hUV5Hs6g9VaY/gtf18 X-Received: by 10.98.59.5 with SMTP id i5mr2331979pfa.146.1517516786609; Thu, 01 Feb 2018 12:26:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517516786; cv=none; d=google.com; s=arc-20160816; b=wlJcp7+3mSye4zJsLvFgrTF/ETG8yoL76tigF3ceVj4fr7xEYCIVKIenexDEXALduF Cyw8tKWI3dH5AjFfVzqxMdq8PIP9FLxXV4X1VhmZX7XfJ5ugLzp/Ddx1RA2cFJLndq3u 5NHSzVfnqEFf4xcYgjSYsGgpvFLosDRbvM8kgh7r4IuMfsYAEKhbaNHLRXolx1Mw9+e8 wGxPAxlvCO2PJxG0j499br3F0b0YBZf/p8d7SVR3l0cJf/K1jAxJbJDiClcNanqC/319 PuPEAR7NeaScg+zS3VGprKiec8i3FBXn8ZOgJwPxl+6eYK3UVkboMAjdE8afQnbUqY1H S8nA== 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=M+oVac+PxdlS8/ljPKujy61NETEc+NB1oiJxlv4RzKs=; b=p6EiezdR5Zf/3wBG9e6/X17m+6nT3fw0CwUm0vqsv2QQv0dGP79sVdazZhkwQO9MzR ddEyQkvvM/84oVsR5/+5qVVeuv5lCPErAzBPS56+w9kddebEHGrh0xKKtGCoykubj6Z6 vx6am/C+L7Wy0H3TJacmnJ7BTp5x0b4WBmuvRZtJUwTud2Sl6HZVFo9r/hFguegGWHcH VLxw6pbjU9XkgsXd+oJWPo+mS4b1PlupFdA+b4VwFR70vRmhN7uGa+l54xgaWSsjuH54 Ki8C//CG2J4O6ZqxwxpdOEbFInMxXvf319acDybGKcSjdfyemc3T7TnZo1E9+aLr5sr7 N3pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pD95cUZj; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i35-v6si299488plg.505.2018.02.01.12.26.12; Thu, 01 Feb 2018 12:26:26 -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=@gmail.com header.s=20161025 header.b=pD95cUZj; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755152AbeBAUY5 (ORCPT + 99 others); Thu, 1 Feb 2018 15:24:57 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:40426 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755139AbeBAUYw (ORCPT ); Thu, 1 Feb 2018 15:24:52 -0500 Received: by mail-lf0-f68.google.com with SMTP id h92so28164533lfi.7 for ; Thu, 01 Feb 2018 12:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=M+oVac+PxdlS8/ljPKujy61NETEc+NB1oiJxlv4RzKs=; b=pD95cUZjc2v977t03CTMrXFnQN7BO3u4Nj8L/gh/uvmaMKSmdCMXpd8qU9vB4GzLxV t7Rr2vPWbIn3a/R9MlNf+1LkujZFBeTiKmuEQdPqsDa5MxcfRnFZMdy/Y4sSb0pmn5g3 eAWRceZdxug6PG7dRDFn9MCRJTF+5T1IIiZfgVnu/E8NXhDQ3nyi9g2hYUdutlb9MJI1 vdOKHjXDHFQtVeUzc/oX5YYVYGWqwzBptbsRAAPL0FZ+Rngn5lfmim2qTDtgds1n6yi1 sx83oKyl4Y9k2sjryI6WlVl/yoWkkyPrlsn2bvcgY8Hti84D42I5bYkCOSta52zrsGKh ly/w== 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-transfer-encoding :content-language; bh=M+oVac+PxdlS8/ljPKujy61NETEc+NB1oiJxlv4RzKs=; b=oXoA/3CLGdK2PtbdvgtD13qDYrxaIapmmUhECbjOvn+62PIXjkADP18cqIS239wSyx LSt26MBdxJv5Yhfk47lwPOxVEazeIo/zwnYgsEbccInd3EjTsDL3+2rwEh/2J8wTIYk2 hXTdHG9IGjZYstahiFt0I6cum5fyvmOhfw9qrVuQzqM7kl1+Q4RjuLZRJ7JjdOoYF4b8 IUWwO/g6k0AZYIfX/PjP+4gUgsZa8ADcAVqkEeX/2XSyHtgbe5kSKZCZL3QNrqh0ypSK s9RUoiZ61oHOTUJyZbpymyAJrqDt+1jcQrMr87EWxBRBwSGcH3JATITO1NS5cYbvkI3b jrgw== X-Gm-Message-State: AKwxytcVGyXgvP51RJLCEAlSUgdi0s7niMWsBleQIcGw2FSun6kynNbX RXFNdPqfHlsS8JjNM8pNUjk= X-Received: by 10.46.20.4 with SMTP id u4mr8170547ljd.53.1517516689966; Thu, 01 Feb 2018 12:24:49 -0800 (PST) Received: from [192.168.0.20] (155-32-94-178.pool.ukrtel.net. [178.94.32.155]) by smtp.googlemail.com with ESMTPSA id g133sm66524lfg.89.2018.02.01.12.24.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 12:24:48 -0800 (PST) Subject: Re: [PATCH] xen: fix frontend driver disconnected from xenbus on removal To: Boris Ostrovsky , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: jgross@suse.com, david.vrabel@citrix.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> From: Oleksandr Andrushchenko Message-ID: <05dc798a-852a-aca4-8098-862ee566e1d8@gmail.com> Date: Thu, 1 Feb 2018 22:24:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <3943477e-7768-ceb3-38a3-3a20cb0e3082@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? If so, do you have something neat on your mind how to solve this? > -boris > >> >> + free_otherend_watch(dev); >> + >> free_otherend_details(dev); >> >> xenbus_switch_state(dev, XenbusStateClosed); Thank you, Oleksandr