[Top][All Lists]

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

Re: [PATCH] osdep.h: Add doc comment for qemu_get_thread_id()

From: Markus Armbruster
Subject: Re: [PATCH] osdep.h: Add doc comment for qemu_get_thread_id()
Date: Fri, 31 Jul 2020 09:44:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Eric Blake <eblake@redhat.com> writes:

> On 7/30/20 10:59 AM, Daniel P. Berrangé wrote:
>>> Well, I suspect that management-layer code currently has
>>> gone for "assume we're always running on Linux" and was
>>> written by people who knew they were getting a Linux tid...
>> Yes, on the libvirt side, the functionality that relies on thread_is is
>> only compiled on Linux. If someone wants to use it on other OS, they'll
>> have to provide an impl using their platforms equivalent of
>> sched_setaffinity and friends since none of this stuff is standardized
>> across OS.
>>>> The PID is quite unlikely to be "an OS-specific identifier of the
>>>> current thread".  Shouldn't we fail instead of lie when we don't know
>>>> how to compute the truth?
>>> Yeah, I think the default codepath is pretty bogus too. Should
>>> the QMP functions have a mechanism for saying "we don't know
>>> a thread-id on this platform" ?
>> Thread_id should be optional and thus not filled in if we
>> can't provide a sensible value. Unfortunately we made it
>> mandatory in QMP.
> Normally, converting a mandatory output value to optional is a
> back-compatibility risk (we could break apps that depended on it being
> present).  But if the only apps that depended on it being present are
> compiled on Linux, where the member will actually be present, I think
> that changing the schema to make it optional for non-Linux platforms
> won't be a back-compatibility nightmare (but we will have to be
> careful in our documentation).

Options for systems where don't know how to compute a system-wide thread

0. Return a bogus value: the PID.  This is the status quo.

1. Return a more obviously bogus value: -1.  Semantic compatibility
   break.  Should be harmless, because a QMP client relying on the
   thread-id being the PID would be insane.

2. Make thread-id optional, present iff we can compute a value.

   This is what we should have done, but we didn't, and now it's a
   syntactic compatibility break.  Matters only if it actually breaks
   QMP clients.  We believe the one we know shouldn't break.


reply via email to

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