From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Xen-devel <xen-devel@lists.xensource.com>,
the arch/x86 maintainers <x86@kernel.org>,
Ian Campbell <ian.campbell@citrix.com>,
Zachary Amsden <zach@vmware.com>,
Ravikiran Thirumalai <kiran@scalemp.com>
Subject: Re: [PATCH 2 of 7] x86/pvops: add a paravirt_ident functions to allow special patching
Date: Thu, 29 Jan 2009 01:26:53 -0800 [thread overview]
Message-ID: <4981765D.8040508@goop.org> (raw)
In-Reply-To: <200901291835.49251.rusty@rustcorp.com.au>
Rusty Russell wrote:
> On Thursday 29 January 2009 09:05:02 Jeremy Fitzhardinge wrote:
>
>> void _paravirt_nop(void);
>> +u32 _paravirt_ident_32(u32);
>> +u64 _paravirt_ident_64(u64);
>> +
>> #define paravirt_nop ((void *)_paravirt_nop)
>>
>
> So, we used a void * cast for the paravirt_nop case, but you decided to use explicit types for the ident cases?
>
Yes. Partly because any nop function is going to be basically
equivalent to (void (*)(void)), but the concrete types for the ident
function will vary (pointer, scalar, structure, etc).
>> if (opfunc == NULL)
>> /* If there's no function, patch it with a ud2a (BUG) */
>> ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
>> - else if (opfunc == paravirt_nop)
>> + else if (opfunc == _paravirt_nop)
>> /* If the operation is a nop, then nop the callsite */
>> ret = paravirt_patch_nop();
>>
>
> Gratuitous change?
>
To make it consistent with the newly added lines following. And its
slightly more correct.
>
>> +typedef pte_t make_pte_t(pteval_t);
>> +typedef pmd_t make_pmd_t(pmdval_t);
>> +typedef pud_t make_pud_t(pudval_t);
>> +typedef pgd_t make_pgd_t(pgdval_t);
>> +
>> +typedef pteval_t pte_val_t(pte_t);
>> +typedef pmdval_t pmd_val_t(pmd_t);
>> +typedef pudval_t pud_val_t(pud_t);
>> +typedef pgdval_t pgd_val_t(pgd_t);
>> +
>> +
>> +#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
>> +/* 32-bit pagetable entries */
>> +#define paravirt_native_make_pte (make_pte_t *)_paravirt_ident_32
>> +#define paravirt_native_pte_val (pte_val_t *)_paravirt_ident_32
>> +
>> +#define paravirt_native_make_pmd (make_pmd_t *)_paravirt_ident_32
>> +#define paravirt_native_pmd_val (pmd_val_t *)_paravirt_ident_32
>> +
>> +#define paravirt_native_make_pud (make_pud_t *)_paravirt_ident_32
>> +#define paravirt_native_pud_val (pud_val_t *)_paravirt_ident_32
>> +
>> +#define paravirt_native_make_pgd (make_pgd_t *)_paravirt_ident_32
>> +#define paravirt_native_pgd_val (pgd_val_t *)_paravirt_ident_32
>> +#else
>> +/* 64-bit pagetable entries */
>> +#define paravirt_native_make_pte (make_pte_t *)_paravirt_ident_64
>> +#define paravirt_native_pte_val (pte_val_t *)_paravirt_ident_64
>> +
>> +#define paravirt_native_make_pmd (make_pmd_t *)_paravirt_ident_64
>> +#define paravirt_native_pmd_val (pmd_val_t *)_paravirt_ident_64
>> +
>> +#define paravirt_native_make_pud (make_pud_t *)_paravirt_ident_64
>> +#define paravirt_native_pud_val (pud_val_t *)_paravirt_ident_64
>> +
>> +#define paravirt_native_make_pgd (make_pgd_t *)_paravirt_ident_64
>> +#define paravirt_native_pgd_val (pgd_val_t *)_paravirt_ident_64
>> +#endif
>>
>
> I think I prefer:
>
> /* make_pte etc and pgd_val etc are identity functions. */
> #define paravirt_native_page_op \
> (sizeof(pte_t) == sizeof(u64) ? paravirt_ident_64 : paravirt_ident_32)
>
> Then use that everywhere rather than these defines?
>
They disappear later in the series anyway.
> But it's a minor point; the code seems perfectly sound.
>
Great, thanks for reviewing.
J
next prev parent reply other threads:[~2009-01-29 9:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 22:35 [PATCH 0 of 7] x86/paravirt: optimise pvop calls and register use Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 1 of 7] xen: move remaining mmu-related stuff into mmu.c Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 2 of 7] x86/pvops: add a paravirt_ident functions to allow special patching Jeremy Fitzhardinge
2009-01-29 8:05 ` Rusty Russell
2009-01-29 9:26 ` Jeremy Fitzhardinge [this message]
2009-01-29 10:46 ` Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 3 of 7] x86: fix paravirt clobber in entry_64.S Jeremy Fitzhardinge
2009-01-29 8:39 ` Rusty Russell
2009-01-29 9:28 ` Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 4 of 7] x86/paravirt: selectively save/restore regs around pvops calls Jeremy Fitzhardinge
2009-01-29 8:47 ` Rusty Russell
2009-01-29 9:30 ` Jeremy Fitzhardinge
2009-01-30 0:27 ` Rusty Russell
2009-01-28 22:35 ` [PATCH 5 of 7] x86/paravirt: add register-saving thunks to reduce caller register pressure Jeremy Fitzhardinge
2009-02-06 7:28 ` Andi Kleen
2009-02-06 16:37 ` Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 6 of 7] x86/paravirt: implement PVOP_CALL macros for callee-save functions Jeremy Fitzhardinge
2009-01-28 22:35 ` [PATCH 7 of 7] x86/paravirt: use callee-saved convention for pte_val/make_pte/etc Jeremy Fitzhardinge
2009-01-29 7:14 ` [PATCH 0 of 7] x86/paravirt: optimise pvop calls and register use H. Peter Anvin
2009-01-29 9:51 ` Jeremy Fitzhardinge
2009-01-31 5:04 ` H. Peter Anvin
2009-01-31 7:16 ` Jeremy Fitzhardinge
2009-01-31 22:43 ` H. Peter Anvin
2009-01-31 7:17 ` [PATCH 1/2] x86/paravirt: don't restore second return reg Jeremy Fitzhardinge
2009-01-31 7:18 ` [PATCH 2/2] x86/vmi: fix interrupt enable/disable/save/restore calling convention Jeremy Fitzhardinge
2009-01-31 16:12 ` [PATCH 0 of 7] x86/paravirt: optimise pvop calls and register use Ingo Molnar
2009-01-31 17:00 ` Jeremy Fitzhardinge
2009-02-04 2:10 ` Ingo Molnar
2009-02-04 2:16 ` Jeremy Fitzhardinge
2009-02-04 14:26 ` Ingo Molnar
2009-02-04 17:06 ` Ingo Molnar
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=4981765D.8040508@goop.org \
--to=jeremy@goop.org \
--cc=ian.campbell@citrix.com \
--cc=kiran@scalemp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
--cc=zach@vmware.com \
/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