WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 2/2] x86: add pte_set_flags/clear_flags for ptefl

To: "Ingo Molnar" <mingo@xxxxxxx>, "Jeremy Fitzhardinge" <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 2/2] x86: add pte_set_flags/clear_flags for pteflag manipulation
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Fri, 23 Jan 2009 08:14:06 +0000
Cc: Nick Piggin <nickpiggin@xxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>
Delivery-date: Fri, 23 Jan 2009 00:14:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4978F216.5040803@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4978F216.5040803@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Jeremy Fitzhardinge <jeremy@xxxxxxxx> 22.01.09 23:24 >>>
>+static inline pte_t pte_set_flags(pte_t pte, pteval_t set)
>+{
>+      pteval_t v = native_pte_val(pte);
>+
>+      return native_make_pte(v | set);
>+}
>+
>+static inline pte_t pte_clear_flags(pte_t pte, pteval_t clear)
>+{
>+      pteval_t v = native_pte_val(pte);
>+
>+      return native_make_pte(v & ~clear);
>+}

I think a comment (or event a BUG_ON()) should be added here to make
clear that this absolutely must not be used to toggle the present bit. I
even view toggling _PAGE_PSE as dangerous this way.

And alternative would be to make these macros and #undef them (or keep
them inline functions but add destructive #define-s) after all their users.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel