From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423357AbXBPGo4 (ORCPT ); Fri, 16 Feb 2007 01:44:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1423358AbXBPGo4 (ORCPT ); Fri, 16 Feb 2007 01:44:56 -0500 Received: from smtp.osdl.org ([65.172.181.24]:54161 "EHLO smtp.osdl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423357AbXBPGoz (ORCPT ); Fri, 16 Feb 2007 01:44:55 -0500 Date: Thu, 15 Feb 2007 22:43:22 -0800 From: Andrew Morton To: Jeremy Fitzhardinge Cc: Andi Kleen , linux-kernel@vger.kernel.org, virtualization@lists.osdl.org, xen-devel@lists.xensource.com, Chris Wright , Zachary Amsden , Ian Pratt , Christian Limpach , "Jan Beulich" Subject: Re: [patch 12/21] Xen-paravirt: Allocate and free vmalloc areas Message-Id: <20070215224322.5c73d8e9.akpm@linux-foundation.org> In-Reply-To: <20070216022531.417300365@goop.org> References: <20070216022449.739760547@goop.org> <20070216022531.417300365@goop.org> X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.17; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Feb 2007 18:25:01 -0800 Jeremy Fitzhardinge wrote: > +void lock_vm_area(struct vm_struct *area) > +{ > + unsigned long i; > + char c; > + > + /* > + * Prevent context switch to a lazy mm that doesn't have this area > + * mapped into its page tables. > + */ > + preempt_disable(); > + > + /* > + * Ensure that the page tables are mapped into the current mm. The > + * page-fault path will copy the page directory pointers from init_mm. > + */ > + for (i = 0; i < area->size; i += PAGE_SIZE) > + (void)__get_user(c, (char __user *)area->addr + i); > +} > +EXPORT_SYMBOL_GPL(lock_vm_area); This won't work when CONFIG_PREEMPT=y. The pagefault handler will see in_atomic() and will scram. (pet-peeve-from-someone-who-remembers-fortran: the reader expects the variable `i' to be signed. signed int really) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 12/21] Xen-paravirt: Allocate and free vmalloc areas Date: Thu, 15 Feb 2007 22:43:22 -0800 Message-ID: <20070215224322.5c73d8e9.akpm@linux-foundation.org> References: <20070216022449.739760547@goop.org> <20070216022531.417300365@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20070216022531.417300365@goop.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.osdl.org Errors-To: virtualization-bounces@lists.osdl.org To: Jeremy Fitzhardinge Cc: Chris Wright , Andi Kleen , xen-devel@lists.xensource.com, Ian Pratt , virtualization@lists.osdl.org, linux-kernel@vger.kernel.org, Jan Beulich List-Id: virtualization@lists.linuxfoundation.org On Thu, 15 Feb 2007 18:25:01 -0800 Jeremy Fitzhardinge wr= ote: > +void lock_vm_area(struct vm_struct *area) > +{ > + unsigned long i; > + char c; > + > + /* > + * Prevent context switch to a lazy mm that doesn't have this area > + * mapped into its page tables. > + */ > + preempt_disable(); > + > + /* > + * Ensure that the page tables are mapped into the current mm. The > + * page-fault path will copy the page directory pointers from init_mm. > + */ > + for (i =3D 0; i < area->size; i +=3D PAGE_SIZE) > + (void)__get_user(c, (char __user *)area->addr + i); > +} > +EXPORT_SYMBOL_GPL(lock_vm_area); This won't work when CONFIG_PREEMPT=3Dy. The pagefault handler will see in_atomic() and will scram. (pet-peeve-from-someone-who-remembers-fortran: the reader expects the variable `i' to be signed. signed int really)