At 2023-07-28 18:45:20, "David Hildenbrand" <da...@redhat.com> wrote:
>>> Quick untested attempt to move retry handling to the caller:
>>>
>>> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
>>> index 3df73542e1..c826bb78fc 100644
>>> --- a/softmmu/physmem.c
>>> +++ b/softmmu/physmem.c
>>> @@ -1289,8 +1289,7 @@ static int64_t get_file_align(int fd)
>>>   static int file_ram_open(const char *path,
>>>                            const char *region_name,
>>>                            bool readonly,
>> 
>> For some reason this prereq part of patch has one additional space,
>> which causes my `patch` to reject the patch. I have to manually
>> fix it to test later.
>
>Yes, to be expected. Pasting a "git show" diff always messes up 
>whitespace for me. It was only meant as a POC.
>
>> 
>>> -                         bool *created,
>>> -                         Error **errp)
>>> +                         bool *created)
>>>   {
>>>       char *filename;
>>>       char *sanitized_name;
>>> @@ -1334,10 +1333,7 @@ static int file_ram_open(const char *path,
>>>               g_free(filename);
>>>           }
>>>           if (errno != EEXIST && errno != EINTR) {
>>> -            error_setg_errno(errp, errno,
>>> -                             "can't open backing store %s for guest RAM",
>>> -                             path);
>>> -            return -1;
>>> +            return -errno;
>>>           }
>>>           /*
>>>            * Try again on EINTR and EEXIST.  The latter happens when
>>> @@ -1946,9 +1942,23 @@ RAMBlock *qemu_ram_alloc_from_file(ram_addr_t size, 
>>> MemoryRegion *mr,
>>>       bool created;
>>>       RAMBlock *block;
>>>   
>>> -    fd = file_ram_open(mem_path, memory_region_name(mr), readonly, 
>>> &created,
>>> -                       errp);
>>> +    fd = file_ram_open(mem_path, memory_region_name(mr), readonly, 
>>> &created);
>>> +    if (fd == -EACCES && !(ram_flags & RAM_SHARED) && readonly) {
>> 
>> "readonly" should be "!readonly" here? The readonly variable in this 
>> function is
>> about whether the mapping is readonly. In our case the mapping is private
>> writable, so readonly will be false.
>
>Yes, indeed!
>
>> 
>> After manually fix this up, this patch also works in my environment, both
>> functionality and the warning.
>> 
>> Maybe you can directly format the patch and start a new thread there?
>
>
>Whatever you prefer! If I resend the patch, I would keep you the author 
>and only add my Co-authored-by: Signed-off-by:.
>
>Just let me know.

Everything is good and clear now. I think it is better that you do the patch
here. Waiting for the final version of patch.

>
>-- 
>Cheers,
>
>David / dhildenb

Reply via email to