From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EA2D62C0097 for ; Thu, 25 Jul 2013 20:33:43 +1000 (EST) Received: by mail-pa0-f52.google.com with SMTP id kq13so1827895pab.25 for ; Thu, 25 Jul 2013 03:33:41 -0700 (PDT) Message-ID: <51F0FEF4.9030309@ozlabs.ru> Date: Thu, 25 Jul 2013 20:33:24 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 To: Alexey Kardashevskiy Subject: Re: [PATCH] powerpc: Prepare to support kernel handling of IOMMU map/unmap References: <1374707624.6142.16.camel@pasglop> <1374747961-28501-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1374747961-28501-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Paul Mackerras , Andrew Morton , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 07/25/2013 08:26 PM, Alexey Kardashevskiy wrote: > The current VFIO-on-POWER implementation supports only user mode > driven mapping, i.e. QEMU is sending requests to map/unmap pages. > However this approach is really slow, so we want to move that to KVM. > Since H_PUT_TCE can be extremely performance sensitive (especially with > network adapters where each packet needs to be mapped/unmapped) we chose > to implement that as a "fast" hypercall directly in "real > mode" (processor still in the guest context but MMU off). > > To be able to do that, we need to provide some facilities to > access the struct page count within that real mode environment as things > like the sparsemem vmemmap mappings aren't accessible. > > This adds an API to get page struct when MMU is off. > > This adds to MM a new function put_page_unless_one() which drops a page > if counter is bigger than 1. It is going to be used when MMU is off > (real mode on PPC64 is the first user) and we want to make sure that page > release will not happen in real mode as it may crash the kernel in > a horrible way. Yes, my english needs to be polished, I even know where :) -- Alexey From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx166.postini.com [74.125.245.166]) by kanga.kvack.org (Postfix) with SMTP id 4065E6B0031 for ; Thu, 25 Jul 2013 06:33:42 -0400 (EDT) Received: by mail-pd0-f169.google.com with SMTP id y10so1540328pdj.0 for ; Thu, 25 Jul 2013 03:33:41 -0700 (PDT) Message-ID: <51F0FEF4.9030309@ozlabs.ru> Date: Thu, 25 Jul 2013 20:33:24 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 Subject: Re: [PATCH] powerpc: Prepare to support kernel handling of IOMMU map/unmap References: <1374707624.6142.16.camel@pasglop> <1374747961-28501-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1374747961-28501-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Alexey Kardashevskiy Cc: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Paul Mackerras , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org On 07/25/2013 08:26 PM, Alexey Kardashevskiy wrote: > The current VFIO-on-POWER implementation supports only user mode > driven mapping, i.e. QEMU is sending requests to map/unmap pages. > However this approach is really slow, so we want to move that to KVM. > Since H_PUT_TCE can be extremely performance sensitive (especially with > network adapters where each packet needs to be mapped/unmapped) we chose > to implement that as a "fast" hypercall directly in "real > mode" (processor still in the guest context but MMU off). > > To be able to do that, we need to provide some facilities to > access the struct page count within that real mode environment as things > like the sparsemem vmemmap mappings aren't accessible. > > This adds an API to get page struct when MMU is off. > > This adds to MM a new function put_page_unless_one() which drops a page > if counter is bigger than 1. It is going to be used when MMU is off > (real mode on PPC64 is the first user) and we want to make sure that page > release will not happen in real mode as it may crash the kernel in > a horrible way. Yes, my english needs to be polished, I even know where :) -- Alexey -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755540Ab3GYKdn (ORCPT ); Thu, 25 Jul 2013 06:33:43 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:51446 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753394Ab3GYKdm (ORCPT ); Thu, 25 Jul 2013 06:33:42 -0400 Message-ID: <51F0FEF4.9030309@ozlabs.ru> Date: Thu, 25 Jul 2013 20:33:24 +1000 From: Alexey Kardashevskiy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: Alexey Kardashevskiy CC: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Paul Mackerras , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] powerpc: Prepare to support kernel handling of IOMMU map/unmap References: <1374707624.6142.16.camel@pasglop> <1374747961-28501-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1374747961-28501-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/25/2013 08:26 PM, Alexey Kardashevskiy wrote: > The current VFIO-on-POWER implementation supports only user mode > driven mapping, i.e. QEMU is sending requests to map/unmap pages. > However this approach is really slow, so we want to move that to KVM. > Since H_PUT_TCE can be extremely performance sensitive (especially with > network adapters where each packet needs to be mapped/unmapped) we chose > to implement that as a "fast" hypercall directly in "real > mode" (processor still in the guest context but MMU off). > > To be able to do that, we need to provide some facilities to > access the struct page count within that real mode environment as things > like the sparsemem vmemmap mappings aren't accessible. > > This adds an API to get page struct when MMU is off. > > This adds to MM a new function put_page_unless_one() which drops a page > if counter is bigger than 1. It is going to be used when MMU is off > (real mode on PPC64 is the first user) and we want to make sure that page > release will not happen in real mode as it may crash the kernel in > a horrible way. Yes, my english needs to be polished, I even know where :) -- Alexey