From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <Andrew.Cooper3@citrix.com>
Cc: Wei Liu <wl@xen.org>, Roger Pau Monne <roger.pau@citrix.com>,
"Tim (Xen.org)" <tim@xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH] x86/shadow: sh_type_to_size[] needs L2H entry when HVM+PV32
Date: Mon, 23 Jan 2023 17:58:42 +0100 [thread overview]
Message-ID: <f13acc85-3cc3-d685-2e32-e47bcbed893d@suse.com> (raw)
In-Reply-To: <e9073354-cc8f-8496-1fb6-d53ff5879ccf@suse.com>
On 23.01.2023 17:56, Jan Beulich wrote:
> On 23.01.2023 13:49, Jan Beulich wrote:
>> On 23.01.2023 13:30, Andrew Cooper wrote:
>>> This is a layering violation which has successfully tricked you into
>>> making a buggy patch.
>>>
>>> I'm unwilling to bet this will be the final time either... "this file
>>> is HVM-only, therefore no PV paths enter it" is a reasonable
>>> expectation, and should be true.
>>
>> Nice abstract consideration, but would mind pointing out how you envision
>> shadow_size() to look like meeting your constraints _and_ meeting my
>> demand of no excess #ifdef-ary? The way I'm reading your reply is that
>> you ask to special case L2H _right in_ shadow_size(). Then again see also
>> my remark in the original (now known faulty) patch regarding such special
>> casing. I could of course follow that route, regardless of HVM (i.e.
>> unlike said there not just for the #else part) ...
>
> Actually no, that remark was about the opposite (!PV32) case, so if I
> took both together, this would result:
>
> static inline unsigned int
> shadow_size(unsigned int shadow_type)
> {
> #ifdef CONFIG_HVM
> #ifdef CONFIG_PV32
> if ( shadow_type == SH_type_l2h_64_shadow )
> return 1;
> #endif
> ASSERT(shadow_type < ARRAY_SIZE(sh_type_to_size));
> return sh_type_to_size[shadow_type];
> #else
> #ifndef CONFIG_PV32
> if ( shadow_type == SH_type_l2h_64_shadow )
> return 0;
> #endif
> ASSERT(shadow_type < SH_type_unused);
> return shadow_type != SH_type_none;
> #endif
> }
>
> I think that's quite a bit worse than using sh_type_to_size[] for all
> kinds of guest uniformly when HVM=y. This
>
> static inline unsigned int
> shadow_size(unsigned int shadow_type)
> {
> if ( shadow_type == SH_type_l2h_64_shadow )
> return IS_ENABLED(CONFIG_PV32);
Which might better use opt_pv32 instead, if we really were to go this route.
Jan
> #ifdef CONFIG_HVM
> ASSERT(shadow_type < ARRAY_SIZE(sh_type_to_size));
> return sh_type_to_size[shadow_type];
> #else
> ASSERT(shadow_type < SH_type_unused);
> return shadow_type != SH_type_none;
> #endif
> }
>
> is also only marginally better, as we really would better avoid any
> such open-coding.
>
> Jan
>
prev parent reply other threads:[~2023-01-23 16:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 8:12 [PATCH] x86/shadow: sh_type_to_size[] needs L2H entry when HVM+PV32 Jan Beulich
2023-01-23 10:43 ` Andrew Cooper
2023-01-23 10:47 ` Jan Beulich
2023-01-23 12:30 ` Andrew Cooper
2023-01-23 12:49 ` Jan Beulich
2023-01-23 16:56 ` Jan Beulich
2023-01-23 16:58 ` Jan Beulich [this message]
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=f13acc85-3cc3-d685-2e32-e47bcbed893d@suse.com \
--to=jbeulich@suse.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=roger.pau@citrix.com \
--cc=tim@xen.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.