qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v4 25/28] cputlb: introduce tlb_flush_* async work


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC v4 25/28] cputlb: introduce tlb_flush_* async work.
Date: Thu, 8 Sep 2016 10:23:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 08/11/2016 08:24 AM, Alex Bennée wrote:
> + * Since QEMU doesn't currently implement a global/not-global flag
> + * for tlb entries, at the moment tlb_flush() will also flush all
> + * tlb entries in the flush_global == false case. This is OK because
> + * CPU architectures generally permit an implementation to drop
> + * entries from the TLB at any time, so flushing more entries than
> + * required is only an efficiency issue, not a correctness issue.
> + */
> +void tlb_flush(CPUState *cpu, int flush_global)
> +{
> +    if (cpu->created && !qemu_cpu_is_self(cpu)) {
> +        if (atomic_bool_cmpxchg(&cpu->pending_tlb_flush, false, true)) {
> +            async_run_on_cpu(cpu, tlb_flush_global_async_work,
> +                             GINT_TO_POINTER(flush_global));

Given that we don't actually do anything with flush_global, let's not work so
hard to pass it down.  Especially with something as ugly as GINT_TO_POINTER.

Or indeed, as a cleanup, remove that argument from all callers.  If we want to
retain the documentation for the targets, we could do

#define tlb_flush_local   tlb_flush
#define tlb_flush_global  tlb_flush


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]