From owner-freebsd-drivers@freebsd.org Wed May 4 13:04:40 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 B239EB2B67C for ; Wed, 4 May 2016 13:04:40 +0000 (UTC) (envelope-from kumara.bsd@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 513391439 for ; Wed, 4 May 2016 13:04:40 +0000 (UTC) (envelope-from kumara.bsd@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id w143so10124190wmw.3 for ; Wed, 04 May 2016 06:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=nbv+mARbuFlt1iJ9zh7+HoWBxXkRlXV/WqQ7Nsa1PTM=; b=K2334RVAZgYkZZKfgqmkQv2OuHmaKpTl70wC1kOxEqZ7jVGSM5NjP6uaqSdwGUH7ET IW+v3NGC26Q6A1jtee3rzwiJ2tNdwjQywdkt+bQ7rn/D8EhE4W8NjP7NY8HfxE6tKPVj nYqeRIWEj+UkJX6wnLTDcGAEtx8ylNXQ5fmhzvS31urTkYLgbB7V9PnC61OLXZxcR2nW /lO0zn4dXCH4M0OnR5Fa+KFyXdS3/xUzWnLuTNq9olCmSOrtMtVNdznXIyqOt28H/Aei 4K3IEjW1zmCCwkYeoyd6EYZnuP6rFBgQay54zXjTtSVx6v/5crEMHJvjafYepK6t/HLq z/0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=nbv+mARbuFlt1iJ9zh7+HoWBxXkRlXV/WqQ7Nsa1PTM=; b=ChhjsrE9mn/CwjLutWtCwkN49h3O3lyJ29qmsMTp6rYS3aZwDJlKSWbFhVM+YABYdw QscE+8y6bMRfQcBPp1LaaVWM9Xe+wlJORltwVj2RN7kXtMcspcQGDyhG+l+T1/VIExPq j9aG4og2f67lf8dkkN7GZ4Hv6DBrHK08bdWNNCkzxBt6A2605rAN5WRm8GAyqLIpFiKh vvJ4Pzjtpu78AvrFs+s8L5Gn11xA1UO/pK+F32ulCkQG48JcLNNo1noMeGkwbAMPfJ7n KjBCdV7nFwFtCdmx9A/KE1kxsN4uICm7A/dC3bgOxbPn4k8HdyY3QBKtwAQAzAK0fZn9 TjNg== X-Gm-Message-State: AOPr4FUSXZt13blrRnZJLaN3KgIpBXp6FtvmpWPkkIykFvb8bgBjqAnsGiEP7SnD8k/paWR4wPGDy5cwOiG+LA== MIME-Version: 1.0 X-Received: by 10.28.153.213 with SMTP id b204mr32090024wme.102.1462367078536; Wed, 04 May 2016 06:04:38 -0700 (PDT) Received: by 10.194.188.6 with HTTP; Wed, 4 May 2016 06:04:38 -0700 (PDT) Received: by 10.194.188.6 with HTTP; Wed, 4 May 2016 06:04:38 -0700 (PDT) In-Reply-To: <20160504112255.GB2422@kib.kiev.ua> References: <20160504112255.GB2422@kib.kiev.ua> Date: Wed, 4 May 2016 18:34:38 +0530 Message-ID: Subject: Re: Device Pager From: kumara rathnavel To: Konstantin Belousov Cc: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 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 13:04:40 -0000 Thanks for the reply. I have mapped it in kernel space. How do I invalidate the kernel vm_page. I have tried removing the vm_page_remove also. But I still am not getting it invalidated. 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.