From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 2/4] x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback()
Date: Thu, 29 Aug 2024 08:13:26 +0200 [thread overview]
Message-ID: <20aeddd3-5a87-42d3-8eb4-478fbdb30321@suse.com> (raw)
In-Reply-To: <17a98dae-51d4-4da0-a35a-1ddf94a06168@citrix.com>
On 28.08.2024 20:56, Andrew Cooper wrote:
> On 28/08/2024 3:56 pm, Jan Beulich wrote:
>> On 28.08.2024 16:44, Andrew Cooper wrote:
>>> On 27/08/2024 5:07 pm, Jan Beulich wrote:
>>>> On 27.08.2024 15:57, Andrew Cooper wrote:
>>>>> + for_each_set_bit ( seg, dirty )
>>>>> + hvm_set_segment_register(curr, seg, &hvmemul_ctxt->seg_reg[seg]);
>>>>> +
>>>>> + hvmemul_ctxt->seg_reg_dirty = 0;
>>>> Why is this suddenly appearing here? You don't mention it in the description,
>>>> so it's not clear whether you found a (however minor) issue, or whether
>>>> that's purely cosmetic (yet then it's still an extra store we could do
>>>> without).
>>> Oh, yes. Nothing anywhere in Xen ever clears these segment dirty bits.
>> hvm_emulate_init_once()?
>
> I meant after emulation. The value is initialised to 0 at the start of day.
>
>>
>>> I suspect the worst that will go wrong is that we'll waste time
>>> re-{VMWRITE,memcpy}-ing the segment registers into the VMCS/VMCB, but
>>> the logic in Xen is definitely not right.
>> I'm on the edge of asking to do such clearing before emulation, not after
>> processing the dirty bits. That would then be hvm_emulate_init_per_insn(),
>> well centralized.
>
> Specifically, hvmemul_ctxt should not believe itself to be dirty after a
> call to hvm_emulate_writeback(), because that's the logic to make the
> context no-longer-dirty.
That's one aspect, yes. Debuggability is another. For that retaining state
until it strictly needs clearing out may be helpful. Plus ...
> That said, the more I look at this, the less convinced I am by it. For
> a function named writeback(), it's doing a very narrow thing that is not
> the usual meaning of the term when it comes to pipelines or insn
> emulation...
... as you say here.
Anyway - I'll leave where to put the clearing to you, just as long as it's
at least mentioned in the description.
Jan
next prev parent reply other threads:[~2024-08-29 6:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 13:57 [PATCH 0/4] xen/bitops: More for_each_bit() conversions Andrew Cooper
2024-08-27 13:57 ` [PATCH 1/4] xen/evtchn: Use bitmap_for_each() in evtchn_check_pollers() Andrew Cooper
2024-08-27 15:57 ` Jan Beulich
2024-08-27 13:57 ` [PATCH 2/4] x86/hvm: Use for_each_set_bit() in hvm_emulate_writeback() Andrew Cooper
2024-08-27 16:07 ` Jan Beulich
2024-08-28 14:44 ` Andrew Cooper
2024-08-28 14:56 ` Jan Beulich
2024-08-28 18:56 ` Andrew Cooper
2024-08-29 6:13 ` Jan Beulich [this message]
2024-08-27 13:57 ` [PATCH 3/4] x86/hvm: Rework hpet_write() for improved code generation Andrew Cooper
2024-08-28 8:13 ` Jan Beulich
2024-08-28 17:50 ` Andrew Cooper
2024-08-29 6:25 ` Jan Beulich
2024-08-27 13:57 ` [PATCH v2 4/4] x86/vmx: Rewrite vmx_sync_pir_to_irr() to be more efficient Andrew Cooper
2024-08-27 16:25 ` Andrew Cooper
2024-08-28 9:19 ` Jan Beulich
2024-08-28 18:08 ` Andrew Cooper
2024-08-28 19:36 ` Andrew Cooper
2024-08-29 6:35 ` Jan Beulich
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=20aeddd3-5a87-42d3-8eb4-478fbdb30321@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--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.