Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbdITVAA (ORCPT ); Wed, 20 Sep 2017 17:00:00 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:26061 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbdITU7l (ORCPT ); Wed, 20 Sep 2017 16:59:41 -0400 Subject: Re: [PATCH v4 02/13] xen/pvcalls: implement frontend disconnect To: Stefano Stabellini , xen-devel@lists.xen.org References: <1505516440-11111-1-git-send-email-sstabellini@kernel.org> <1505516440-11111-2-git-send-email-sstabellini@kernel.org> Cc: linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini From: Boris Ostrovsky Message-ID: <7e7a8208-f4d8-a628-9c7f-fa2e2c71ebe8@oracle.com> Date: Wed, 20 Sep 2017 16:59:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1505516440-11111-2-git-send-email-sstabellini@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1265 Lines: 43 > > static int pvcalls_front_remove(struct xenbus_device *dev) > { > + struct pvcalls_bedata *bedata; > + struct sock_mapping *map = NULL, *n; > + > + bedata = dev_get_drvdata(&pvcalls_front_dev->dev); > + dev_set_drvdata(&dev->dev, NULL); > + pvcalls_front_dev = NULL; One more comment on this patch: should this be the last thing to do? pvcalls_front_dev is what prevents pvcalls_front_probe() from proceeding and even though I am not sure a probe can be initiated while we are here perhaps moving this to the end would make things slightly safer. -boris > + if (bedata->irq >= 0) > + unbind_from_irqhandler(bedata->irq, dev); > + > + smp_mb(); > + while (atomic_read(&pvcalls_refcount) > 0) > + cpu_relax(); > + list_for_each_entry_safe(map, n, &bedata->socket_mappings, list) { > + pvcalls_front_free_map(bedata, map); > + kfree(map); > + } > + list_for_each_entry_safe(map, n, &bedata->socketpass_mappings, list) { > + spin_lock(&bedata->socket_lock); > + list_del_init(&map->list); > + spin_unlock(&bedata->socket_lock); > + kfree(map); > + } > + if (bedata->ref >= 0) > + gnttab_end_foreign_access(bedata->ref, 0, 0); > + kfree(bedata->ring.sring); > + kfree(bedata); > + xenbus_switch_state(dev, XenbusStateClosed); > return 0; > } >