* [Qemu-devel] [PATCH] linux-user/main.c: Remove redundant end_exclusive()
@ 2015-01-23 10:17 Chen Gang S
2015-01-23 10:20 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang S @ 2015-01-23 10:17 UTC (permalink / raw)
To: riku.voipio; +Cc: QEMU Trivial, qemu-devel
start/end_exclusive() need be pairs, except the start_exclusive() in
stop_all_tasks() which is only used by force_sig(), which will be abort.
So at present, start_exclusive() in stop_all_task() need not be paired.
So need remove end_exclusive() after queue_signal(). If could really
return from queue_signal(), which meant stop_all_task() is not called (
at least, not called in time), the next end_exclusive() would be issue.
Also use TARGET_SIGSEGV instead of SIGSEGV, since queue_signal() is for
TARGET_*, at present, queue_signal() is a normal function which may call
force_sig(), or return (may kill pid or queue signal, then return).
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
linux-user/main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 8c70be4..a410a17 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -517,14 +517,12 @@ segv:
end_exclusive();
/* We get the PC of the entry address - which is as good as anything,
on a real kernel what you get depends on which mode it uses. */
- info.si_signo = SIGSEGV;
+ info.si_signo = TARGET_SIGSEGV;
info.si_errno = 0;
/* XXX: check env->error_code */
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = env->exception.vaddress;
queue_signal(env, info.si_signo, &info);
-
- end_exclusive();
}
/* Handle a jump to the kernel code page. */
--
1.9.3 (Apple Git-50)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user/main.c: Remove redundant end_exclusive()
2015-01-23 10:17 [Qemu-devel] [PATCH] linux-user/main.c: Remove redundant end_exclusive() Chen Gang S
@ 2015-01-23 10:20 ` Peter Maydell
2015-01-23 10:38 ` Chen Gang S
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2015-01-23 10:20 UTC (permalink / raw)
To: Chen Gang S; +Cc: QEMU Trivial, Riku Voipio, qemu-devel
On 23 January 2015 at 10:17, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
> start/end_exclusive() need be pairs, except the start_exclusive() in
> stop_all_tasks() which is only used by force_sig(), which will be abort.
> So at present, start_exclusive() in stop_all_task() need not be paired.
>
> So need remove end_exclusive() after queue_signal(). If could really
> return from queue_signal(), which meant stop_all_task() is not called (
> at least, not called in time), the next end_exclusive() would be issue.
>
> Also use TARGET_SIGSEGV instead of SIGSEGV, since queue_signal() is for
> TARGET_*, at present, queue_signal() is a normal function which may call
> force_sig(), or return (may kill pid or queue signal, then return).
It would be helpful to mention the affected target architecture
(and/or function name) in the commit message, because main.c covers
a lot of ground.
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
> linux-user/main.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 8c70be4..a410a17 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -517,14 +517,12 @@ segv:
> end_exclusive();
> /* We get the PC of the entry address - which is as good as anything,
> on a real kernel what you get depends on which mode it uses. */
> - info.si_signo = SIGSEGV;
> + info.si_signo = TARGET_SIGSEGV;
I think this is a correct bug fix, but it's not really related
to the main point of the patch (fixing end_exclusive()) and
there are actually a lot of instances of it in this file and
possibly others. Could you fix it (and those others) in a separate
patch, please?
> info.si_errno = 0;
> /* XXX: check env->error_code */
> info.si_code = TARGET_SEGV_MAPERR;
> info._sifields._sigfault._addr = env->exception.vaddress;
> queue_signal(env, info.si_signo, &info);
> -
> - end_exclusive();
> }
This change is correct.
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user/main.c: Remove redundant end_exclusive()
2015-01-23 10:20 ` Peter Maydell
@ 2015-01-23 10:38 ` Chen Gang S
0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang S @ 2015-01-23 10:38 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Trivial, Riku Voipio, qemu-devel
On 1/23/15 18:20, Peter Maydell wrote:
> On 23 January 2015 at 10:17, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
>> start/end_exclusive() need be pairs, except the start_exclusive() in
>> stop_all_tasks() which is only used by force_sig(), which will be abort.
>> So at present, start_exclusive() in stop_all_task() need not be paired.
>>
>> So need remove end_exclusive() after queue_signal(). If could really
>> return from queue_signal(), which meant stop_all_task() is not called (
>> at least, not called in time), the next end_exclusive() would be issue.
>>
>> Also use TARGET_SIGSEGV instead of SIGSEGV, since queue_signal() is for
>> TARGET_*, at present, queue_signal() is a normal function which may call
>> force_sig(), or return (may kill pid or queue signal, then return).
>
> It would be helpful to mention the affected target architecture
> (and/or function name) in the commit message, because main.c covers
> a lot of ground.
>
OK, thanks, I shall notice about it, next.
>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>> ---
>> linux-user/main.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/linux-user/main.c b/linux-user/main.c
>> index 8c70be4..a410a17 100644
>> --- a/linux-user/main.c
>> +++ b/linux-user/main.c
>> @@ -517,14 +517,12 @@ segv:
>> end_exclusive();
>> /* We get the PC of the entry address - which is as good as anything,
>> on a real kernel what you get depends on which mode it uses. */
>> - info.si_signo = SIGSEGV;
>> + info.si_signo = TARGET_SIGSEGV;
>
> I think this is a correct bug fix, but it's not really related
> to the main point of the patch (fixing end_exclusive()) and
> there are actually a lot of instances of it in this file and
> possibly others. Could you fix it (and those others) in a separate
> patch, please?
>
OK, thanks, I shall send related patch for it within 2 days.
>> info.si_errno = 0;
>> /* XXX: check env->error_code */
>> info.si_code = TARGET_SEGV_MAPERR;
>> info._sifields._sigfault._addr = env->exception.vaddress;
>> queue_signal(env, info.si_signo, &info);
>> -
>> - end_exclusive();
>> }
>
> This change is correct.
>
OK, thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-23 10:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-23 10:17 [Qemu-devel] [PATCH] linux-user/main.c: Remove redundant end_exclusive() Chen Gang S
2015-01-23 10:20 ` Peter Maydell
2015-01-23 10:38 ` Chen Gang S
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).