On 08/17/2018 01:17 PM, Jan Kiszka wrote:
> On 2018-08-17 12:55, Ralf Ramsauer wrote:
>> Hi,
>>
>> On 08/17/2018 09:19 AM, Jan Kiszka wrote:
>>> Hi Ralf,
>>>
>>> this seems to work, despite the comment. Do you remember why we have
>>> that restriction?
>>>
>>> diff --git a/hypervisor/include/jailhouse/header.h
>>> b/hypervisor/include/jailhouse/header.h
>>> index 518bc5cb..9dc76f81 100644
>>> --- a/hypervisor/include/jailhouse/header.h
>>> +++ b/hypervisor/include/jailhouse/header.h
>>> @@ -43,7 +43,7 @@ struct jailhouse_virt_console {
>>>       unsigned int tail;
>>>       /* current implementation requires the size of the content to be a
>>>        * power of two */
>>> -    char content[2048];
>>> +    char content[4096 - 2 * sizeof(unsigned int)];
>>
>> That's been a while… I remember that there have been some arguments, but
>> it's in deed not obvious by looking at the code…
>>
>> [grabs out an old review of a previous revision]
>>
>> Here's the rationale: [1]
>>
>> Writer side increments the tail pointer without modulo operations
>> (hv/printk.c:41). If it's not a power of two, it will fail as we get
>> misaligned once we overflow the unsigned int. AFAICT, on reader side
>> we're relying on that alignement (main.c:281).
> 
> We should improve on documenting that inline.

True.

> 
>>
>> This issue should become visible, once the tail pointer overflows 32
>> bit. You could test this situation by offsetting the initialisation of
>> head/tail.
> 
> Right. I was hoping to "cheaply" increase the buffer because it already
> overflows during enable on the NUC6CAY. But it's probably easier to
> expand it by adding real pages.

Huh? More than 2048 byte log for enabling?

The downside is that adding a second page wastes again half of its memory.

  Ralf

> 
> Jan
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to