qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util: qemu_get_thread_id for OpenBSD
@ 2020-07-14 21:26 David CARLIER
  2020-07-15  4:54 ` Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: David CARLIER @ 2020-07-14 21:26 UTC (permalink / raw)
  To: qemu-devel, QEMU Trivial

From 9c7f54c67d40fae0174ba795fbaad829cd59c264 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen@gmail.com>
Date: Tue, 14 Jul 2020 23:23:55 +0100
Subject: [PATCH] util: qemu_get_thread_id implementation for OpenBSD.

ussage of getthrid syscall.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 util/oslib-posix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 72907d4d7f..b4f7de83c8 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -100,6 +100,8 @@ int qemu_get_thread_id(void)
     return (int)tid;
 #elif defined(__NetBSD__)
     return _lwp_self();
+#elif defined(__OpenBSD__)
+    return getthrid();
 #else
     return getpid();
 #endif
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] util: qemu_get_thread_id for OpenBSD
  2020-07-14 21:26 [PATCH] util: qemu_get_thread_id for OpenBSD David CARLIER
@ 2020-07-15  4:54 ` Thomas Huth
  2020-07-15  7:39   ` Brad Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2020-07-15  4:54 UTC (permalink / raw)
  To: David CARLIER, qemu-devel, QEMU Trivial, Brad Smith

On 14/07/2020 23.26, David CARLIER wrote:
> From 9c7f54c67d40fae0174ba795fbaad829cd59c264 Mon Sep 17 00:00:00 2001
> From: David Carlier <devnexen@gmail.com>
> Date: Tue, 14 Jul 2020 23:23:55 +0100
> Subject: [PATCH] util: qemu_get_thread_id implementation for OpenBSD.
> 
> ussage of getthrid syscall.
> 
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
>  util/oslib-posix.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 72907d4d7f..b4f7de83c8 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -100,6 +100,8 @@ int qemu_get_thread_id(void)
>      return (int)tid;
>  #elif defined(__NetBSD__)
>      return _lwp_self();
> +#elif defined(__OpenBSD__)
> +    return getthrid();
>  #else
>      return getpid();
>  #endif
> 

 Brad,

since you're listed as OpenBSD maintainer, could you please review above
patch?

 Thanks,
  Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] util: qemu_get_thread_id for OpenBSD
  2020-07-15  4:54 ` Thomas Huth
@ 2020-07-15  7:39   ` Brad Smith
  2020-07-16 14:39     ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Brad Smith @ 2020-07-15  7:39 UTC (permalink / raw)
  To: Thomas Huth, David CARLIER, qemu-devel, QEMU Trivial

On 7/15/2020 12:54 AM, Thomas Huth wrote:
> On 14/07/2020 23.26, David CARLIER wrote:
>>  From 9c7f54c67d40fae0174ba795fbaad829cd59c264 Mon Sep 17 00:00:00 2001
>> From: David Carlier <devnexen@gmail.com>
>> Date: Tue, 14 Jul 2020 23:23:55 +0100
>> Subject: [PATCH] util: qemu_get_thread_id implementation for OpenBSD.
>>
>> ussage of getthrid syscall.
>>
>> Signed-off-by: David Carlier <devnexen@gmail.com>
>> ---
>>   util/oslib-posix.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
>> index 72907d4d7f..b4f7de83c8 100644
>> --- a/util/oslib-posix.c
>> +++ b/util/oslib-posix.c
>> @@ -100,6 +100,8 @@ int qemu_get_thread_id(void)
>>       return (int)tid;
>>   #elif defined(__NetBSD__)
>>       return _lwp_self();
>> +#elif defined(__OpenBSD__)
>> +    return getthrid();
>>   #else
>>       return getpid();
>>   #endif
>>
>   Brad,
>
> since you're listed as OpenBSD maintainer, could you please review above
> patch?

Thank you David and Thomas.

Reviewed-by: Brad Smith <brad@comstyle.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] util: qemu_get_thread_id for OpenBSD
  2020-07-15  7:39   ` Brad Smith
@ 2020-07-16 14:39     ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-07-16 14:39 UTC (permalink / raw)
  To: Brad Smith; +Cc: QEMU Trivial, Thomas Huth, David CARLIER, qemu-devel

On Wed, 15 Jul 2020 at 08:41, Brad Smith <brad@comstyle.com> wrote:
>
> On 7/15/2020 12:54 AM, Thomas Huth wrote:
> > On 14/07/2020 23.26, David CARLIER wrote:
> >>  From 9c7f54c67d40fae0174ba795fbaad829cd59c264 Mon Sep 17 00:00:00 2001
> >> From: David Carlier <devnexen@gmail.com>
> >> Date: Tue, 14 Jul 2020 23:23:55 +0100
> >> Subject: [PATCH] util: qemu_get_thread_id implementation for OpenBSD.
> >>
> >> ussage of getthrid syscall.
> >>
> >> Signed-off-by: David Carlier <devnexen@gmail.com>
> >> ---
> >>   util/oslib-posix.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> >> index 72907d4d7f..b4f7de83c8 100644
> >> --- a/util/oslib-posix.c
> >> +++ b/util/oslib-posix.c
> >> @@ -100,6 +100,8 @@ int qemu_get_thread_id(void)
> >>       return (int)tid;
> >>   #elif defined(__NetBSD__)
> >>       return _lwp_self();
> >> +#elif defined(__OpenBSD__)
> >> +    return getthrid();
> >>   #else
> >>       return getpid();
> >>   #endif
> >>
> >   Brad,
> >
> > since you're listed as OpenBSD maintainer, could you please review above
> > patch?
>
> Thank you David and Thomas.
>
> Reviewed-by: Brad Smith <brad@comstyle.com>

Thanks for the review. Since this is a one-liner I'll take it into
the tree via target-arm.next just for convenience.

Side note: the only things we use this value for are:
 (1) it appears in the output of the QMP monitor's query-cpus and
query-iothreads commands, so that a management layer app can
use whatever the host OS provides for setting host CPU
affinity to tie a particular guest vCPU thread to a host CPU.
 (2) the log tracing backend uses it in the output just as a
way to allow tracing from different threads to be distinguished

We should really write a doc comment explaining that. Maybe
I'll put a patch together.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-16 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 21:26 [PATCH] util: qemu_get_thread_id for OpenBSD David CARLIER
2020-07-15  4:54 ` Thomas Huth
2020-07-15  7:39   ` Brad Smith
2020-07-16 14:39     ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).