[PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function

Warner Losh posted 14 patches 4 years, 4 months ago
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>
There is a newer version of this series
[PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
Create dummy signal queueing function so we can start to integrate other
architectures (at the cost of signals remaining broken) to tame the
dependency graph a bit and to bring in signals in a more controlled
fashion.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/qemu.h   | 1 +
 bsd-user/signal.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 5a2fd87e44..85d1f8fd2a 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
 void signal_init(void);
 long do_sigreturn(CPUArchState *env);
 long do_rt_sigreturn(CPUArchState *env);
+int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
 abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
 
 /* mmap.c */
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index ad6d935569..4e7f618944 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -19,6 +19,14 @@
 #include "qemu/osdep.h"
 
 #include "qemu.h"
+/*
+ * Queue a signal so that it will be send to the virtual CPU as soon as
+ * possible.
+ */
+int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
+{
+    return 1;
+}
 
 void signal_init(void)
 {
-- 
2.32.0


Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Richard Henderson 4 years, 4 months ago
On 9/21/21 11:14 PM, Warner Losh wrote:
> Create dummy signal queueing function so we can start to integrate other
> architectures (at the cost of signals remaining broken) to tame the
> dependency graph a bit and to bring in signals in a more controlled
> fashion.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>   bsd-user/qemu.h   | 1 +
>   bsd-user/signal.c | 8 ++++++++
>   2 files changed, 9 insertions(+)
> 
> diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> index 5a2fd87e44..85d1f8fd2a 100644
> --- a/bsd-user/qemu.h
> +++ b/bsd-user/qemu.h
> @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
>   void signal_init(void);
>   long do_sigreturn(CPUArchState *env);
>   long do_rt_sigreturn(CPUArchState *env);
> +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
>   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
>   
>   /* mmap.c */
> diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> index ad6d935569..4e7f618944 100644
> --- a/bsd-user/signal.c
> +++ b/bsd-user/signal.c
> @@ -19,6 +19,14 @@
>   #include "qemu/osdep.h"
>   
>   #include "qemu.h"
> +/*

Whacky whitespace.

> + * Queue a signal so that it will be send to the virtual CPU as soon as
> + * possible.
> + */
> +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> +{
> +    return 1;
> +}

Both here and in linux-user, there are no error conditions.  We should change the return 
to void.

Also, consider folding in the signal-common.h cleanup soon.
But don't let either hold you up too much with rebasing.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 9/21/21 11:14 PM, Warner Losh wrote:
> > Create dummy signal queueing function so we can start to integrate other
> > architectures (at the cost of signals remaining broken) to tame the
> > dependency graph a bit and to bring in signals in a more controlled
> > fashion.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >   bsd-user/qemu.h   | 1 +
> >   bsd-user/signal.c | 8 ++++++++
> >   2 files changed, 9 insertions(+)
> >
> > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> > index 5a2fd87e44..85d1f8fd2a 100644
> > --- a/bsd-user/qemu.h
> > +++ b/bsd-user/qemu.h
> > @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
> >   void signal_init(void);
> >   long do_sigreturn(CPUArchState *env);
> >   long do_rt_sigreturn(CPUArchState *env);
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
> >   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr,
> abi_ulong sp);
> >
> >   /* mmap.c */
> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> > index ad6d935569..4e7f618944 100644
> > --- a/bsd-user/signal.c
> > +++ b/bsd-user/signal.c
> > @@ -19,6 +19,14 @@
> >   #include "qemu/osdep.h"
> >
> >   #include "qemu.h"
> > +/*
>
> Whacky whitespace.
>

Fixed.


> > + * Queue a signal so that it will be send to the virtual CPU as soon as
> > + * possible.
> > + */
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> > +{
> > +    return 1;
> > +}
>
> Both here and in linux-user, there are no error conditions.  We should
> change the return
> to void.
>

In this stubbed out version, there's no errors. But bsd-user can return
-EAGAIN when
alloc_sigqueue fails (which it can if there are no free qemu_sigqueue
structures in
the preallocated list0. However, having said that, nothing checks the
return value
so it's as if it is void... So I'll change it to void here...


> Also, consider folding in the signal-common.h cleanup soon.
> But don't let either hold you up too much with rebasing.
>

I plan to. Once that's cleaned up and into the repo, I'll rebase bsd-user
in the
fork, fold in the changes needed and then look at how I'm going to upstream
things.

Warner


> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> r~
>
Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Philippe Mathieu-Daudé 4 years, 4 months ago
On Sun, Sep 26, 2021 at 8:14 PM Warner Losh <imp@bsdimp.com> wrote:
> On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <richard.henderson@linaro.org> wrote:
>> On 9/21/21 11:14 PM, Warner Losh wrote:
>> > Create dummy signal queueing function so we can start to integrate other
>> > architectures (at the cost of signals remaining broken) to tame the
>> > dependency graph a bit and to bring in signals in a more controlled
>> > fashion.
>> >
>> > Signed-off-by: Warner Losh <imp@bsdimp.com>
>> > ---
>> >   bsd-user/qemu.h   | 1 +
>> >   bsd-user/signal.c | 8 ++++++++
>> >   2 files changed, 9 insertions(+)

>> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
>> > +{
>> > +    return 1;
>> > +}
>>
>> Both here and in linux-user, there are no error conditions.  We should change the return
>> to void.
>
>
> In this stubbed out version, there's no errors. But bsd-user can return -EAGAIN when
> alloc_sigqueue fails (which it can if there are no free qemu_sigqueue structures in
> the preallocated list0. However, having said that, nothing checks the return value
> so it's as if it is void... So I'll change it to void here...

kinda related:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg836833.html

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
On Sun, Sep 26, 2021 at 12:34 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On Sun, Sep 26, 2021 at 8:14 PM Warner Losh <imp@bsdimp.com> wrote:
> > On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <
> richard.henderson@linaro.org> wrote:
> >> On 9/21/21 11:14 PM, Warner Losh wrote:
> >> > Create dummy signal queueing function so we can start to integrate
> other
> >> > architectures (at the cost of signals remaining broken) to tame the
> >> > dependency graph a bit and to bring in signals in a more controlled
> >> > fashion.
> >> >
> >> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> >> > ---
> >> >   bsd-user/qemu.h   | 1 +
> >> >   bsd-user/signal.c | 8 ++++++++
> >> >   2 files changed, 9 insertions(+)
>
> >> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> >> > +{
> >> > +    return 1;
> >> > +}
> >>
> >> Both here and in linux-user, there are no error conditions.  We should
> change the return
> >> to void.
> >
> >
> > In this stubbed out version, there's no errors. But bsd-user can return
> -EAGAIN when
> > alloc_sigqueue fails (which it can if there are no free qemu_sigqueue
> structures in
> > the preallocated list0. However, having said that, nothing checks the
> return value
> > so it's as if it is void... So I'll change it to void here...
>
> kinda related:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg836833.html


Not sure how I missed this... too many filters I guess.

I've sent a reply, but the right thing to do is to eliminate *that* wart
too. I'm always
torn between 'oh, linux-user went in a different direction that I like
better' for something
and adopting it and 'oh, more churn in upstreaming, I'll never get done and
how do I make
sure I don't break anything'...

Warner
Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Philippe Mathieu-Daudé 4 years, 4 months ago
On Sun, Sep 26, 2021 at 9:00 PM Warner Losh <imp@bsdimp.com> wrote:
> On Sun, Sep 26, 2021 at 12:34 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> On Sun, Sep 26, 2021 at 8:14 PM Warner Losh <imp@bsdimp.com> wrote:
>> > On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <richard.henderson@linaro.org> wrote:
>> >> On 9/21/21 11:14 PM, Warner Losh wrote:
>> >> > Create dummy signal queueing function so we can start to integrate other
>> >> > architectures (at the cost of signals remaining broken) to tame the
>> >> > dependency graph a bit and to bring in signals in a more controlled
>> >> > fashion.
>> >> >
>> >> > Signed-off-by: Warner Losh <imp@bsdimp.com>
>> >> > ---
>> >> >   bsd-user/qemu.h   | 1 +
>> >> >   bsd-user/signal.c | 8 ++++++++
>> >> >   2 files changed, 9 insertions(+)
>>
>> >> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
>> >> > +{
>> >> > +    return 1;
>> >> > +}
>> >>
>> >> Both here and in linux-user, there are no error conditions.  We should change the return
>> >> to void.
>> >
>> >
>> > In this stubbed out version, there's no errors. But bsd-user can return -EAGAIN when
>> > alloc_sigqueue fails (which it can if there are no free qemu_sigqueue structures in
>> > the preallocated list0. However, having said that, nothing checks the return value
>> > so it's as if it is void... So I'll change it to void here...
>>
>> kinda related:
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg836833.html
>
>
> Not sure how I missed this... too many filters I guess.
>
> I've sent a reply, but the right thing to do is to eliminate *that* wart too. I'm always
> torn between 'oh, linux-user went in a different direction that I like better' for something
> and adopting it and 'oh, more churn in upstreaming, I'll never get done and how do I make
> sure I don't break anything'...

Oh no worry. I have in my TODO to clean this, but got delayed by the
has_work() refactor series.

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <
richard.henderson@linaro.org> wrote:

> On 9/21/21 11:14 PM, Warner Losh wrote:
> > Create dummy signal queueing function so we can start to integrate other
> > architectures (at the cost of signals remaining broken) to tame the
> > dependency graph a bit and to bring in signals in a more controlled
> > fashion.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >   bsd-user/qemu.h   | 1 +
> >   bsd-user/signal.c | 8 ++++++++
> >   2 files changed, 9 insertions(+)
> >
> > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> > index 5a2fd87e44..85d1f8fd2a 100644
> > --- a/bsd-user/qemu.h
> > +++ b/bsd-user/qemu.h
> > @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
> >   void signal_init(void);
> >   long do_sigreturn(CPUArchState *env);
> >   long do_rt_sigreturn(CPUArchState *env);
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
> >   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr,
> abi_ulong sp);
> >
> >   /* mmap.c */
> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> > index ad6d935569..4e7f618944 100644
> > --- a/bsd-user/signal.c
> > +++ b/bsd-user/signal.c
> > @@ -19,6 +19,14 @@
> >   #include "qemu/osdep.h"
> >
> >   #include "qemu.h"
> > +/*
>
> Whacky whitespace.
>

fixed.


> > + * Queue a signal so that it will be send to the virtual CPU as soon as
> > + * possible.
> > + */
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> > +{
> > +    return 1;
> > +}
>
> Both here and in linux-user, there are no error conditions.  We should
> change the return
> to void.
>

I'll prep a patch to follow up for both linux and bsd user.


> Also, consider folding in the signal-common.h cleanup soon.
> But don't let either hold you up too much with rebasing.
>

It's on my list. This 'dummy' routine is just to get things linking to
help simplify the rather tangled dependency tree to get things
in, still have them compile and still have at least simple hello
world continue to work. Behind these reviews are three streams
of patches for 3 more architectures: arm, aarch64 and riscv64.

I'll create a patch for both linux-user and fix in bsd-user as part of the
signal.c upstreaming I'm working on.

It brings to mind something else... There's times it might be easier
to refactor between bsd-user and linux-user rather than upstream
something that's largely copied from linux-user. Is there a good
way to do that and talk about the design before I sink a ton of time
into something that's the wrong direction?

Thanks for the reviews and feedback.

Warner


> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> r~
>
Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Richard Henderson 4 years, 4 months ago
On 9/24/21 4:11 PM, Warner Losh wrote:
> It brings to mind something else... There's times it might be easier
> to refactor between bsd-user and linux-user rather than upstream
> something that's largely copied from linux-user. Is there a good
> way to do that and talk about the design before I sink a ton of time
> into something that's the wrong direction?

I certainly wouldn't mind a top-level user-only/ or posix-only/ in which we could share 
code between {linux,bsd}-user/, but I don't have a good idea of what that would look like.

Already you have code for MAP_EXCL that doesn't exist for linux (though there is a new, 
related, MAP_FIXED_NOREPLACE, which linux-user/ does not yet support).  So even with 
"obvious" routines I'm not sure how much real sharing we can get away with.

All I can say is: patches welcome, and we'll bike-shed them as they come.


r~

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Kyle Evans 4 years, 4 months ago
On Fri, Sep 24, 2021 at 3:11 PM Warner Losh <imp@bsdimp.com> wrote:
>
>
>
> On Fri, Sep 24, 2021 at 6:00 AM Richard Henderson <richard.henderson@linaro.org> wrote:
>>
>> On 9/21/21 11:14 PM, Warner Losh wrote:
>> > Create dummy signal queueing function so we can start to integrate other
>> > architectures (at the cost of signals remaining broken) to tame the
>> > dependency graph a bit and to bring in signals in a more controlled
>> > fashion.
>> >
>> > Signed-off-by: Warner Losh <imp@bsdimp.com>
>> > ---
>> >   bsd-user/qemu.h   | 1 +
>> >   bsd-user/signal.c | 8 ++++++++
>> >   2 files changed, 9 insertions(+)
>> >
>> > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
>> > index 5a2fd87e44..85d1f8fd2a 100644
>> > --- a/bsd-user/qemu.h
>> > +++ b/bsd-user/qemu.h
>> > @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
>> >   void signal_init(void);
>> >   long do_sigreturn(CPUArchState *env);
>> >   long do_rt_sigreturn(CPUArchState *env);
>> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
>> >   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
>> >
>> >   /* mmap.c */
>> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
>> > index ad6d935569..4e7f618944 100644
>> > --- a/bsd-user/signal.c
>> > +++ b/bsd-user/signal.c
>> > @@ -19,6 +19,14 @@
>> >   #include "qemu/osdep.h"
>> >
>> >   #include "qemu.h"
>> > +/*
>>
>> Whacky whitespace.
>
>
> fixed.
>
>>
>> > + * Queue a signal so that it will be send to the virtual CPU as soon as
>> > + * possible.
>> > + */
>> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
>> > +{
>> > +    return 1;
>> > +}
>>
>> Both here and in linux-user, there are no error conditions.  We should change the return
>> to void.
>
>
> I'll prep a patch to follow up for both linux and bsd user.
>
>>
>> Also, consider folding in the signal-common.h cleanup soon.
>> But don't let either hold you up too much with rebasing.
>
>
> It's on my list. This 'dummy' routine is just to get things linking to
> help simplify the rather tangled dependency tree to get things
> in, still have them compile and still have at least simple hello
> world continue to work. Behind these reviews are three streams
> of patches for 3 more architectures: arm, aarch64 and riscv64.
>
> I'll create a patch for both linux-user and fix in bsd-user as part of the
> signal.c upstreaming I'm working on.
>
> It brings to mind something else... There's times it might be easier
> to refactor between bsd-user and linux-user rather than upstream
> something that's largely copied from linux-user. Is there a good
> way to do that and talk about the design before I sink a ton of time
> into something that's the wrong direction?
>

I had a proposal on this list a long while back to refactor some stuff
into a top-level qemu-user that could be shared between the two,
starting with safe_syscall (which syscall can be substantially
shared), but it hadn't received any traction at that time.

Thanks,

Kyle Evans

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Philippe Mathieu-Daudé 4 years, 4 months ago
On 9/22/21 08:14, Warner Losh wrote:
> Create dummy signal queueing function so we can start to integrate other
> architectures (at the cost of signals remaining broken) to tame the
> dependency graph a bit and to bring in signals in a more controlled
> fashion.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>   bsd-user/qemu.h   | 1 +
>   bsd-user/signal.c | 8 ++++++++
>   2 files changed, 9 insertions(+)
> 
> diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> index 5a2fd87e44..85d1f8fd2a 100644
> --- a/bsd-user/qemu.h
> +++ b/bsd-user/qemu.h
> @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
>   void signal_init(void);
>   long do_sigreturn(CPUArchState *env);
>   long do_rt_sigreturn(CPUArchState *env);
> +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
>   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
>   
>   /* mmap.c */
> diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> index ad6d935569..4e7f618944 100644
> --- a/bsd-user/signal.c
> +++ b/bsd-user/signal.c
> @@ -19,6 +19,14 @@
>   #include "qemu/osdep.h"
>   
>   #include "qemu.h"
> +/*
> + * Queue a signal so that it will be send to the virtual CPU as soon as
> + * possible.
> + */
> +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> +{
> +    return 1;

Shouldn't we abort() here or at least call qemu_log_mask(LOG_UNIMP)?

> +}
>   
>   void signal_init(void)
>   {
> 

Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
On Sat, Sep 25, 2021, 4:50 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On 9/22/21 08:14, Warner Losh wrote:
> > Create dummy signal queueing function so we can start to integrate other
> > architectures (at the cost of signals remaining broken) to tame the
> > dependency graph a bit and to bring in signals in a more controlled
> > fashion.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> >   bsd-user/qemu.h   | 1 +
> >   bsd-user/signal.c | 8 ++++++++
> >   2 files changed, 9 insertions(+)
> >
> > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> > index 5a2fd87e44..85d1f8fd2a 100644
> > --- a/bsd-user/qemu.h
> > +++ b/bsd-user/qemu.h
> > @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
> >   void signal_init(void);
> >   long do_sigreturn(CPUArchState *env);
> >   long do_rt_sigreturn(CPUArchState *env);
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
> >   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr,
> abi_ulong sp);
> >
> >   /* mmap.c */
> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
> > index ad6d935569..4e7f618944 100644
> > --- a/bsd-user/signal.c
> > +++ b/bsd-user/signal.c
> > @@ -19,6 +19,14 @@
> >   #include "qemu/osdep.h"
> >
> >   #include "qemu.h"
> > +/*
> > + * Queue a signal so that it will be send to the virtual CPU as soon as
> > + * possible.
> > + */
> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
> > +{
> > +    return 1;
>
> Shouldn't we abort() here or at least call qemu_log_mask(LOG_UNIMP)?
>

Sure. This code is just a placeholder for the moment so that I can prepare
the full signal.c later, but still be able to submit my next 3 patch series
which add aarch64, arm and riscv64. It can be anything you'd like without
generating conflicts.

When I spin the next version I'll have at least an abort here.

Warner

> +}
> >
> >   void signal_init(void)
> >   {
> >
>
Re: [PATCH 14/14] bsd-user/signal: Create a dummy signal queueing function
Posted by Warner Losh 4 years, 4 months ago
On Sat, Sep 25, 2021 at 8:53 AM Warner Losh <imp@bsdimp.com> wrote:

>
>
> On Sat, Sep 25, 2021, 4:50 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
> wrote:
>
>> On 9/22/21 08:14, Warner Losh wrote:
>> > Create dummy signal queueing function so we can start to integrate other
>> > architectures (at the cost of signals remaining broken) to tame the
>> > dependency graph a bit and to bring in signals in a more controlled
>> > fashion.
>> >
>> > Signed-off-by: Warner Losh <imp@bsdimp.com>
>> > ---
>> >   bsd-user/qemu.h   | 1 +
>> >   bsd-user/signal.c | 8 ++++++++
>> >   2 files changed, 9 insertions(+)
>> >
>> > diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
>> > index 5a2fd87e44..85d1f8fd2a 100644
>> > --- a/bsd-user/qemu.h
>> > +++ b/bsd-user/qemu.h
>> > @@ -209,6 +209,7 @@ void process_pending_signals(CPUArchState *cpu_env);
>> >   void signal_init(void);
>> >   long do_sigreturn(CPUArchState *env);
>> >   long do_rt_sigreturn(CPUArchState *env);
>> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
>> >   abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr,
>> abi_ulong sp);
>> >
>> >   /* mmap.c */
>> > diff --git a/bsd-user/signal.c b/bsd-user/signal.c
>> > index ad6d935569..4e7f618944 100644
>> > --- a/bsd-user/signal.c
>> > +++ b/bsd-user/signal.c
>> > @@ -19,6 +19,14 @@
>> >   #include "qemu/osdep.h"
>> >
>> >   #include "qemu.h"
>> > +/*
>> > + * Queue a signal so that it will be send to the virtual CPU as soon as
>> > + * possible.
>> > + */
>> > +int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
>> > +{
>> > +    return 1;
>>
>> Shouldn't we abort() here or at least call qemu_log_mask(LOG_UNIMP)?
>>
>
> Sure. This code is just a placeholder for the moment so that I can prepare
> the full signal.c later, but still be able to submit my next 3 patch series
> which add aarch64, arm and riscv64. It can be anything you'd like without
> generating conflicts.
>
> When I spin the next version I'll have at least an abort here.
>

I'll add the log_unimp stuff too. In debugging something else, I've learned
how to use qemu_log and will convert a few things as well (though I'm not
yet sure the sequencing of those upstream).

Warner


> Warner
>
> > +}
>> >
>> >   void signal_init(void)
>> >   {
>> >
>>
>