lkml.org 
[lkml]   [2022]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] um: read multiple msg from virtio slave request fd
Am 01.06.2022 um 19:13 schrieb Johannes Berg:
> On Wed, 2022-06-01 at 15:37 +0000, Benjamin Beichler wrote:
>
> Hmm. How did you run into this? Why would a device send many messages
> and not wait for ACK, but the kernel side actually waits for ACK? What
> would the use case for that be? Seems a bit odd, if both wait for ACK
> there shouldn't be an issue?
>
> Anyway, I guess I don't mind fixing this regardless of whether I see a
> use case where it could happen :-)

Here is my (admittedly maybe odd) case:

I want to use hwsim over virtio with UML but without time travel (as a
precursor for a later version with TT)

I modified wmediumd to strip out the scheduler dependency and wrote a
very simple simulation, which simply forwards all frames to all radios.
Furthermore, I use the usfstl "loop" as main driver to poll all fds
without time travel. This leads to the situation, that when a msg is put
on the RX-ring of an uml instance, which also sent concurrently a kick
(e.g., also trying to send a frame), this creates a deadlock. In the
original wmediumd this was handled by kind of a hack, calling the loop
implementation to answer the kick, before sending out a call msg. I need
to rip out this workaround, because without the usfstl scheduler, it
created a deep recursion of the loop implementation with additional
problems.

Nonetheless, even if this would be kind of an optimization: it is
feasible to wait for the ACK asynchronously, as long as it arrives in
the same point of simulation time (or as you called it calender). For
many uml-instances, which could easily run in parallel, this allows an
easier implementation (at least in my planning :-) ). Of course, it
would be hard to distinguish, which call-request was acked, but at the
end wmediumd (and I also plan to do so) simply aborts when the ack is
negative, so the actual corresponding call is not that important to know.

>
> This code changed a bit, you should rebase onto the uml tree's for-next
> branch.
My bad, I was not expecting someone to change something it that corner
of the kernel, I only used the latest master and not the next. I will
redo the patch with ease.
>
>> + while (1) {
>> + if (vhost_user_recv_req(vu_dev, &msg.msg,
>> + sizeof(msg.msg.payload)
>> + + sizeof(msg.extra_payload)))
> prefer to keep the + on the previous line.
>
It slightly hits the 80 column restriction, but I would also prefer not
to break. :-D
> That said, my attempt at rebasing this made it all fail completely,
> maybe you have better luck :)
>
> johannes
>
kind regards

Benjamin

--
M.Sc. Benjamin Beichler

Universität Rostock, Fakultät für Informatik und Elektrotechnik
Institut für Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Straße 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email:Benjamin.Beichler@uni-rostock.de
www:http://www.imd.uni-rostock.de/
[unhandled content-type:application/pkcs7-signature]
\
 
 \ /
  Last update: 2022-06-02 10:34    [W:0.066 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site