From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Subject: Re: [PATCH 18/19] KVM: PPC: Book3S HV: add passthrough support Date: Wed, 30 Jan 2019 16:55:46 +1100 Message-ID: <20190130055546.GC27109@blackberry> References: <20190107191006.10648-1-clg@kaod.org> <20190107191006.10648-2-clg@kaod.org> <20190122052657.GG15124@blackberry> <20190123103009.GB29826@blackberry> <75762dbe-0f08-5b06-e376-744ff87ff4cb@kaod.org> <20190128061353.GD3237@blackberry> <38b0244d-beb6-3aee-c638-279ca570633c@kaod.org> <20190129041241.GA17660@blackberry> <2fd9b526-347d-a1d5-925b-bc633231de64@kaod.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, David Gibson To: =?iso-8859-1?Q?C=E9dric?= Le Goater Return-path: Content-Disposition: inline In-Reply-To: <2fd9b526-347d-a1d5-925b-bc633231de64@kaod.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org On Tue, Jan 29, 2019 at 06:44:50PM +0100, Cédric Le Goater wrote: > On 1/29/19 5:12 AM, Paul Mackerras wrote: > > On Mon, Jan 28, 2019 at 07:26:00PM +0100, Cédric Le Goater wrote: > >> > >> Is clearing the PTEs and repopulating the VMA unsafe ? > > > > Actually, now that I come to think of it, there could be any number of > > VMAs (well, up to almost 64k of them), since once you have a file > > descriptor you can call mmap on it multiple times. > > > > The more I think about it, the more I think that getting userspace to > > manage the mappings with mmap() and munmap() is the right idea if it > > can be made to work. > > We might be able to mmap() and munmap() regions of ESB pages in the RTAS > call "ibm,change-msi". I think that's the right spot for it. I was thinking that the ESB pages should be mmapped for device interrupts at VM startup or when a device is hot-plugged in, and munmapped when the device is hot-removed. Maybe the mmap could be done in conjunction with the KVM_IRQFD call? What is the reasoning behind doing it in the ibm,change-msi call? Paul. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Date: Wed, 30 Jan 2019 05:55:46 +0000 Subject: Re: [PATCH 18/19] KVM: PPC: Book3S HV: add passthrough support Message-Id: <20190130055546.GC27109@blackberry> List-Id: References: <20190107191006.10648-1-clg@kaod.org> <20190107191006.10648-2-clg@kaod.org> <20190122052657.GG15124@blackberry> <20190123103009.GB29826@blackberry> <75762dbe-0f08-5b06-e376-744ff87ff4cb@kaod.org> <20190128061353.GD3237@blackberry> <38b0244d-beb6-3aee-c638-279ca570633c@kaod.org> <20190129041241.GA17660@blackberry> <2fd9b526-347d-a1d5-925b-bc633231de64@kaod.org> In-Reply-To: <2fd9b526-347d-a1d5-925b-bc633231de64@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, David Gibson On Tue, Jan 29, 2019 at 06:44:50PM +0100, C=E9dric Le Goater wrote: > On 1/29/19 5:12 AM, Paul Mackerras wrote: > > On Mon, Jan 28, 2019 at 07:26:00PM +0100, C=E9dric Le Goater wrote: > >> > >> Is clearing the PTEs and repopulating the VMA unsafe ?=20 > >=20 > > Actually, now that I come to think of it, there could be any number of > > VMAs (well, up to almost 64k of them), since once you have a file > > descriptor you can call mmap on it multiple times. > >=20 > > The more I think about it, the more I think that getting userspace to > > manage the mappings with mmap() and munmap() is the right idea if it > > can be made to work. >=20 > We might be able to mmap() and munmap() regions of ESB pages in the RTAS = > call "ibm,change-msi". I think that's the right spot for it.=20 I was thinking that the ESB pages should be mmapped for device interrupts at VM startup or when a device is hot-plugged in, and munmapped when the device is hot-removed. Maybe the mmap could be done in conjunction with the KVM_IRQFD call? What is the reasoning behind doing it in the ibm,change-msi call? Paul.