public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Adrian Bunk <bunk@stusta.de>
Cc: akpm@osdl.org, chrisl@vmware.com, chrisw@osdl.org,
	linux-kernel@vger.kernel.org, mbligh@mbligh.org,
	pratap@vmware.com, virtualization@lists.osdl.org
Subject: Re: [PATCH 5/6] i386 virtualization - Make generic set wrprotect a macro
Date: Mon, 15 Aug 2005 17:05:30 -0700	[thread overview]
Message-ID: <43012DCA.2080701@vmware.com> (raw)
In-Reply-To: <20050815232502.GG3614@stusta.de>

Adrian Bunk wrote:

>On Mon, Aug 15, 2005 at 04:00:39PM -0700, zach@vmware.com wrote:
>
>  
>
>>Make the generic version of ptep_set_wrprotect a macro.  This is good for
>>code uniformity, and fixes the build for architectures which include pgtable.h
>>through headers into assembly code, but do not define a ptep_set_wrprotect
>>function.
>>    
>>
>
>
>This against the kernel coding style.
>In fact, we are usually doing exactly the opposite. 
>
>What exactly is the technical problem this patch is trying to solve, IOW 
>which architectures are breaking for you?
>  
>

The generic pgtable.h include is special and apparently deliberately 
against kernel coding style.  Look at the rest of the file.  All 
"functions" here are purely macros, or encapsulated with:

#ifndef __ASSEMBLY__
static inline void foo()
#endif

This is because asm-generic/pgtable.h can get included in assembler 
files via a number of ways.

Now, if you have a header file that gets conditionally excluded based on 
#ifndef __ASSEMBLY__,  as asm-i386/pgtable.h does to 
pgtable-{2|3}level.h you must do one of the following:

1) move all  __HAVE_ARCH_PTEP_XXX definitions out of the !__ASSEMBLY__ 
clause
2) protect all inline assembler functions in asm-generic/pgtable.h with 
!__ASSEMBLY
3) use macros instead of inline functions in asm-generic

Having the ability to redefine page table accessors at the sub-arch 
level is necessary to have a paravirtualized sub-arch of i386.  My third 
attempt at this (the first was a horror unthinkable to even publish) is 
trying to make the code as clean and consistent as possible.  #1 above 
makes maintaing compile time PAE for i386 with a paravirtualized 
sub-arch cumbersome, since one must either isolate the __HAVE_ARCH _XXX 
defines from the XXX function definition itself, surround each 
individual function with !__ASSEMBLY__, or switch to macros instead of 
inline functions for include/asm-i386/pgtable-{2|3}level.h.  Ugly and 
difficult to maintain.

Thus, I chose the default convention of following the surrounding code.  
There are 6 C inline functions in the generic pgtable.h and 37 macros.  
Converting to and from macros and inline functions here is rather 
tedious and error prone, all of these functions are conditionally 
defined based on the architecture, and I don't want to risk introducing 
yet another regression for an architecture that I don't have a 
cross-compile set up for.

If you have a better approch, I'd be interested in hearing it.

Zach

  reply	other threads:[~2005-08-16  0:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 23:00 [PATCH 5/6] i386 virtualization - Make generic set wrprotect a macro zach
2005-08-15 23:25 ` Adrian Bunk
2005-08-16  0:05   ` Zachary Amsden [this message]
2005-08-16  5:51 ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43012DCA.2080701@vmware.com \
    --to=zach@vmware.com \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@mbligh.org \
    --cc=pratap@vmware.com \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox