From owner-freebsd-xen@freebsd.org Fri Aug 5 16:59:44 2016 Return-Path: Delivered-To: freebsd-xen@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A06BB0AE9 for ; Fri, 5 Aug 2016 16:59:44 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6717A14C9; Fri, 5 Aug 2016 16:59:44 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id i5so45558981wmg.0; Fri, 05 Aug 2016 09:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=G+J5z9CaH/P4by2loiuiZDvUUi+QtVukee7zBQXwdJ8=; b=Aln1kiEe3GglBkYo3ocSnCH3nLEpncklW9Rj/cz4Lzkb8BlF0QOgXko9fcVmPP7hwQ wPwVyu/6nCFNIjU0+zRcbjj+v/DXc8OZTfQjCyAj/0DyhrwxE+L4O9MIYiTiHj3DH7hG iHGxspH9ohjhTgqQwxYLlgqL5IREAQcb93B+w77jht9Naw1VqV0aMhiGFhhct1DXLxrD oMd6/IbuMA0mQkHg1gwpuJ5jdlpce7NjGEmPPzDh5rWO2f8lm+LnHnobzOq/DESIDSbg t70TRu1EIglibGpDc9Qv1Ice3ponTs9ePCyBxRNs0s9FFnvVncuJCpwilzp/p3vYJ2J8 AMdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=G+J5z9CaH/P4by2loiuiZDvUUi+QtVukee7zBQXwdJ8=; b=ldGkyVluFRrr4UzpGNPk6JQij9wtGS5lN/gkxeIWrZCHs+257oYF4RD18aXOd463pg v2Ei5Xf7buQ5zUhTO1NNeOMnLpEGurOtfstZ2OSbIfM1dI1vcSf7JPPN1hVAQ637gj0n qUa13RVYs+CO3qLJj42S0ykktaxlBeDw18fUalLwa1qpMtiSscZH74PomuySB4gJCeBs i3EX1mOfa9X/Dvo3e5/TS0g7hNSuJeTBVCJ0IhwBGZmjGjFxrVwFpaJGheiVUl8Aqxxj 0dPTpbgVz/gRZ+/yfDYKaZtwZrkDtFlVXQYcivpvgPVBdbl3pYp3rBAhD9CydiJ7Ga5R bzBw== X-Gm-Message-State: AEkoouuissn8z0fyt63uAItDjlOCFVr8rzGJ2DOWyEutDXXeCFlkDoxLF/AMRRTm8a23hg== X-Received: by 10.194.175.201 with SMTP id cc9mr72222011wjc.38.1470416382676; Fri, 05 Aug 2016 09:59:42 -0700 (PDT) Received: from localhost (21.red-79-152-23.dynamicip.rima-tde.net. [79.152.23.21]) by smtp.gmail.com with ESMTPSA id 190sm9465241wmk.13.2016.08.05.09.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 09:59:41 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Fri, 5 Aug 2016 18:59:38 +0200 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Akshay Jaggi Cc: freebsd-xen@freebsd.org Subject: Re: Event Channel notification issue - Gntdev device Message-ID: <20160805165938.kg4af6ly5lywdp4r@mac> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2-neo (2016-06-11) X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 16:59:44 -0000 On Thu, Aug 04, 2016 at 03:57:40PM +0530, Akshay Jaggi wrote: > Hi, > > I've been working on unmap notifications for the grant table user space > device (check progress: https://reviews.freebsd.org/D7293). > > I've added and tested unmap_clear_byte notification and unmap_send_event > notification is left. > > I was implementing the unmap_send_notify on event-channel, but I am stuck. > Basically, linux grabs a reference to the event-channel port, in case it is > deallocated, so that it can still send a notify. I could not find such a > reference-grabbing mechanism for event channel in FreeBSD. What should I do > now? > Should I add notify, adding the constraint that you cannot deallocate your > reference to that port till the notify is sent (ie, after an unmap). No, that would be quite bad because user-space applications could cause page faults in the kernel. You should look into adding reference counts to FreeBSD event channels. You probably want to add a refcount(9) to struct xenisrc that you increment/decrement in order to count references. A helper function to pick extra references to event channels should also be added to the interface exposed by xen_intr. Roger.