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

Re: [Xen-devel] [PATCH v5 2/4] x86/HVM: implement memory read caching for insn emulation



On 03.03.2020 16:16, Durrant, Paul wrote:
>> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of Jan 
>> Beulich
>> Sent: 03 March 2020 10:17
>>
>> --- a/xen/arch/x86/hvm/emulate.c
>> +++ b/xen/arch/x86/hvm/emulate.c
>> @@ -28,6 +28,19 @@
>>  #include <asm/iocap.h>
>>  #include <asm/vm_event.h>
>>
>> +struct hvmemul_cache
>> +{
>> +    /* The cache is disabled as long as num_ents > max_ents. */
>> +    unsigned int num_ents;
>> +    unsigned int max_ents;
>> +    struct {
>> +        paddr_t gpa:PADDR_BITS;
>> +        unsigned int :BITS_PER_LONG - PADDR_BITS - 8;
> 
> Is clang ok with unnamed fields?

Clang 5 at least is, and iirc this is a standard C feature.

>> +void hvmemul_cache_restore(struct vcpu *v, unsigned int token)
>> +{
>> +    struct hvmemul_cache *cache = v->arch.hvm.hvm_io.cache;
>> +
>> +    ASSERT(cache->num_ents > cache->max_ents);
>> +    cache->num_ents = token;
> 
> ASSERT(token <= cache->max_ents) here?

Hmm, not sure. Definitely not exactly as you say, as disabling
in already disabled state would return max_ents + 1, and hence
this value could also be fed back here. But even beyond that I
don't see a need to restrict the value range here - anything
larger than max_ents will simply result in the cache being
disabled.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.