From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbdJYNsf (ORCPT ); Wed, 25 Oct 2017 09:48:35 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:18109 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbdJYNsd (ORCPT ); Wed, 25 Oct 2017 09:48:33 -0400 Subject: Re: [PATCH v6 02/13] xen/pvcalls: implement frontend disconnect To: Stefano Stabellini , xen-devel@lists.xen.org References: <1508866413-30141-1-git-send-email-sstabellini@kernel.org> <1508866413-30141-2-git-send-email-sstabellini@kernel.org> Cc: linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini From: Boris Ostrovsky Message-ID: <0a050ea7-2062-8a2c-7929-629e105f218e@oracle.com> Date: Wed, 25 Oct 2017 09:49:54 -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: <1508866413-30141-2-git-send-email-sstabellini@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/24/2017 01:33 PM, Stefano Stabellini wrote: > +static void pvcalls_front_free_map(struct pvcalls_bedata *bedata, > + struct sock_mapping *map, bool locked) > +{ > +} > + > static const struct xenbus_device_id pvcalls_front_ids[] = { > { "pvcalls" }, > { "" } > @@ -27,6 +66,32 @@ > > static int pvcalls_front_remove(struct xenbus_device *dev) > { > + struct pvcalls_bedata *bedata; > + struct sock_mapping *map = NULL, *n; Your last comment made me look again at sock_mapping definition. And then I noticed that it is not defined until patch 4 ;-( -boris > + > + bedata = dev_get_drvdata(&pvcalls_front_dev->dev); > + dev_set_drvdata(&dev->dev, NULL); > + pvcalls_front_dev = NULL; > + 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) { > + if (map->active_socket) { > + /* No need to lock, refcount is 0 */ > + pvcalls_front_free_map(bedata, map, true); > + } else { > + list_del(&map->list); > + 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; > } >