From owner-freebsd-arch@freebsd.org Thu May 12 10:30:42 2016 Return-Path: Delivered-To: freebsd-arch@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 B023EB388D4 for ; Thu, 12 May 2016 10:30:42 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 912191BA1 for ; Thu, 12 May 2016 10:30:42 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 8CBD9B388D3; Thu, 12 May 2016 10:30:42 +0000 (UTC) Delivered-To: arch@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 8C5D9B388D2 for ; Thu, 12 May 2016 10:30:42 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from mail-oi0-x232.google.com (mail-oi0-x232.google.com [IPv6:2607:f8b0:4003:c06::232]) (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 5CE7C1BA0; Thu, 12 May 2016 10:30:42 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: by mail-oi0-x232.google.com with SMTP id k142so112411929oib.1; Thu, 12 May 2016 03:30:42 -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:content-transfer-encoding; bh=/Vofah/vBNqFSIh9a1ISInlH5GhjKBfmnfd2gjanGag=; b=Ji61iHqtby4WhUNL8p1Q/nHVZHHMoDnom/FU+WpDsOSG34zKtmqEJuP/23ozR4+FQN M2kAzIrtSdKa73PxVD0yKCr/AlzT61DIkkkTggeotGZ/wsshxtag/OGB2RG1yZ5tWgwK QojvaiU/c8vWswqD1Xs9NhiqnE692x0otLiluh8J55+tsjLZVoNhyITK8UUOM2BqjLO+ T2m7bYUtifPeTc8w0Es+ldhW/yNm1CfV7M89tFUSEZnfnZiXGzWYmE/uwqQj9kQQ30+z Rx38yH4XWzz2rL6PUWm+R3bPun0BKUXA020J9pJbVJUhm6QgiHkgyMaG9qg/iIOUzBGj 3hTg== 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:content-transfer-encoding; bh=/Vofah/vBNqFSIh9a1ISInlH5GhjKBfmnfd2gjanGag=; b=aMT0tJU4i3Jagqiuz58rxO0azK8er4Ne58dnVaMoXHtQlkhy580Bje/lFv8rzkiGFY S+MWKtPrToo9yh5wvyputISXo+FDTxZb4Lt+Wxz7NwruEmLr5D1B45fgREWSM4maqEQD JvAy7uEf7wxTkAa/eIpTRUaDznwmToZlBlXYN8JFw1wblnKbI61wQ6cumOCRReUE2Cca PgdGEivyqg8rrMGBrO9M+18+WtKOACjy5xCea6KelnxmlJSu381Vf0MdYVX3nQDgAPS0 WdvpP8yqGA/26TrxsucBhqPeMsu23jsNPnwA0QGyW5Y5MU1MWtsr6+SNxf3RtmUm0jMf xtHQ== X-Gm-Message-State: AOPr4FWxo2Ts65eWvJqAd59XQPJS31GdvAa2qFLBHolXfN4r41Q8bS6RLj5EMvaKphTHPt2OloXoakDn6VD6ug== MIME-Version: 1.0 X-Received: by 10.202.60.131 with SMTP id j125mr4378926oia.42.1463049041285; Thu, 12 May 2016 03:30:41 -0700 (PDT) Received: by 10.60.9.129 with HTTP; Thu, 12 May 2016 03:30:41 -0700 (PDT) In-Reply-To: References: Date: Thu, 12 May 2016 12:30:41 +0200 Message-ID: Subject: Re: MMU Notifiers and the quest for graphics feature parity From: =?UTF-8?Q?Ren=C3=A9_Ladan?= To: "K. Macy" Cc: "freebsd-arch@freebsd.org" , Mark Johnston , Ed Maste Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2016 10:30:42 -0000 2016-05-12 5:37 GMT+02:00 K. Macy : > My motivation for writing this email stems from my recent work extending = the > linuxkpi to facilitate updating graphics support for FreeBSD. I've made > reasonable progress limiting my changes to the linuxkpi so far. I have 3D= HW > acceleration working on an essentially unmodified 4.6-rc5 drm and i915 dr= iver. > The 4.6 i915 driver supports all of Haswell (3.8 doesn't), Broadwall, Sky= lake, > and the, as of yet, unreleased Kaby Lake processors. Additionally, I am > expecting a Thinkpad e565 (AMD based) to arrive on Friday which will allo= w me > to bring up amdgpu (the Radeon driver for post 2013 AMD GPU hardware) thi= s > weekend. I find this exciting as it means that FreeBSD will be able to ru= n on > _all_ x86 graphics hardware. Unfortunately, most if not all ARM GPU drive= rs > are closed source. > > This isn't quite everything though. There is a new "userptr" ioctl in > graphics drivers that allows applications to safely register user memory = with > the driver. This works because if pages are evicted or the process goes = away, > the driver will be notified first. This notification takes place through = the > "mmu notifier" facility. > > MMU Notifiers are essentially just VM callbacks (or in FreeBSD parlance > eventhandlers). They were first added to Linux to enable KVM to better > interoperate with the native VM's resident set management: > > https://lwn.net/Articles/266320/ > > They're now also used by IB, IOMMUs, MPSS (Xeon Phi), and graphics driver= s. > The API is well enough documented in the header file: > > http://lxr.free-electrons.com/source/include/linux/mmu_notifier.h > > > I don't have strong feelings for what these are called or their precise > location. I do, however, need to be able to support roughly equivalent > semantics when I register these eventhandlers from the notifer calls in t= he > linuxkpi. > > I haven't worked on the VM in a year or two so don't know quite how to pr= oceed. > I'm happy to produce patches for review, but fear that they might be reje= cted > out of hand for one reason or another. I'd like feedback on the approach > itself and what I might do to make any proposed patches more palatable. > I have a laptop with both an nVidia GeForce 940M and a built-in graphics card on the Intel i7 6500U CPU: vgapci0@pci0:0:2:0: class=3D0x030000 card=3D0x09851025 chip=3D0x1916808= 6 rev=3D0x07 hdr=3D0x00 vendor =3D 'Intel Corporation' device =3D 'HD Graphics 520' class =3D display subclass =3D VGA So if I understand correctly this 520 chip might work with your patch? Stock FreeBSD 11.0 r298793 with xf86-video-intel 2.21.15_9 does not see the driver. For now it does run with scfb. Thanks for your work, Ren=C3=A9 --=20 https://rene-ladan.nl/