[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e77fe471-1c65-571d-2b9e-d97c2ee0706f@linux.intel.com>
Date: Tue, 1 Oct 2019 20:33:45 +0800
From: Like Xu <like.xu@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
rkrcmar@...hat.com, sean.j.christopherson@...el.com,
vkuznets@...hat.com, Jim Mattson <jmattson@...gle.com>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
ak@...ux.intel.com, wei.w.wang@...el.com, kan.liang@...el.com,
like.xu@...el.com, ehankland@...gle.com, arbel.moshe@...cle.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] KVM: x86/vPMU: Add lazy mechanism to release
perf_event per vPMC
Hi Peter,
On 2019/10/1 16:23, Peter Zijlstra wrote:
> On Mon, Sep 30, 2019 at 03:22:57PM +0800, Like Xu wrote:
>> + union {
>> + u8 event_count :7; /* the total number of created perf_events */
>> + bool enable_cleanup :1;
>
> That's atrocious, don't ever create a bitfield with base _Bool.
I saw this kind of usages in the tree such as "struct
arm_smmu_master/tipc_mon_state/regmap_irq_chip".
I'm not sure is this your personal preference or is there a technical
reason such as this usage is not incompatible with union syntax?
My design point is to save a little bit space without introducing
two variables such as "int event_count & bool enable_cleanup".
One of the alternatives is to introduce "u8 pmu_state", where the last
seven bits are event_count for X86_PMC_IDX_MAX and the highest bit is
the enable_cleanup bit. Are you OK with this ?
By the way, is the lazy release mechanism looks reasonable to you?
>
>> + } state;
>
Powered by blists - more mailing lists