From owner-freebsd-drivers@freebsd.org Wed May 4 11:23:01 2016 Return-Path: Delivered-To: freebsd-drivers@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 6B001B2C821 for ; Wed, 4 May 2016 11:23:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E10D911C1 for ; Wed, 4 May 2016 11:23:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u44BMtYe097050 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 4 May 2016 14:22:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u44BMtYe097050 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u44BMtAe097049; Wed, 4 May 2016 14:22:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 4 May 2016 14:22:55 +0300 From: Konstantin Belousov To: kumara rathnavel Cc: freebsd-drivers@freebsd.org Subject: Re: Device Pager Message-ID: <20160504112255.GB2422@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2016 11:23:01 -0000 On Wed, May 04, 2016 at 07:51:55AM +0530, kumara rathnavel wrote: > Hello All, > > I have written a character device pager. I have associated an object with > my device and I have mapped it to the kernel and I also have a virtual > address for it. So whenever the address is accessed first time I get a page > fault and i give the physical address to be associated in the fault > routine. Now how do I again get a page fault for the same virtual address. > I need to change the physical address periodically for a virtual address. This cannot be done with the device_pager, i.e. OBJT_DEVICE. VM system does not track mappings of the page into userspace processes, so it cannot invalidate existing mappings. What can be used for this purpose is OBJT_MGTDEVICE, which operates on managed fictitious pages. Such pages do track userspace mappings with the usual PV-lists mechanisms, so pmap_remove_all() works. This kind of pager is used by GEM and TTM. There is not much useful documentation about OBJT_MGTDEVICE, read the source to see how it is plumbed.