qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] blkdebug: ignore invalid rules in non-coroutine context


From: Paolo Bonzini
Subject: Re: [PATCH] blkdebug: ignore invalid rules in non-coroutine context
Date: Thu, 13 Oct 2022 15:06:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1

On 10/13/22 12:56, Markus Armbruster wrote:
rule_check() is called from blkdebug_co_preadv(), blkdebug_co_pwritev(),
blkdebug_co_pwrite_zeroes(), blkdebug_co_pdiscard(),
blkdebug_co_block_status() (all marked coroutine_fn), and
blkdebug_co_flush() (which looks like it should be marked coroutine_fn).

Yes (separate patch sent, 20221013123711.620631-11-pbonzini@redhat.com/T/#u">https://lore.kernel.org/qemu-devel/20221013123711.620631-11-pbonzini@redhat.com/T/#u).

Ignorant question: how could it be called outside coroutine context?

You're right, only blkdebug_debug_event() can be called outside coroutine context. I confused process_rule() (called by blkdebug_debug_event(), both inside and outside coroutine context) with rule_check() (called in coroutine context).

Also, code smell: reporting an error without taking an error path.  But
let's worry about that only after I understand the problem you're trying
to fix.

Unfortunately there's no way to know in advance if an event will be called inside vs. outside a coroutine. I can keep the abort() if you think it's preferrable, so what you get is still a crash but with a nicer error message. Since this is debugging code either solution has pros and cons.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]