From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9vwF-0006r2-C8 for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:55:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9vwD-00026g-3L for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:55:34 -0400 Received: from mail-vk0-x22a.google.com ([2607:f8b0:400c:c05::22a]:32849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9vwC-00026V-U7 for qemu-devel@nongnu.org; Mon, 06 Jun 2016 10:55:33 -0400 Received: by mail-vk0-x22a.google.com with SMTP id d64so78943927vkb.0 for ; Mon, 06 Jun 2016 07:55:32 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1463494687-25947-1-git-send-email-peter.maydell@linaro.org> References: <1463494687-25947-1-git-send-email-peter.maydell@linaro.org> From: Peter Maydell Date: Mon, 6 Jun 2016 15:55:12 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v2 0/6] user-exec: cpu_resume_from_signal() cleanups List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers Cc: Eduardo Habkost , Sergey Fedorov , Patch Tracking , Riku Voipio , Paolo Bonzini , Richard Henderson Ping! thanks -- PMM On 17 May 2016 at 15:18, Peter Maydell wrote: > I was trying to reason about user-mode's handling of signal masks, > and I found our current code a bit confusing, so I cleaned it up. > > At the moment for user-only mode cpu_resume_from_signal() takes a > usercontext pointer; if this is non-NULL then it has some awkward > OS and CPU specific code to set the signal mask from something > inside the usercontext before doing the same kind of siglongjmp() > that the softmmu cpu_resume_from_signal() does. > > In fact the two use cases are completely separate: > * almost all calls to cpu_resume_from_signal() pass a NULL puc > argument (and most of those are softmmu-only anyway) > * only the code path handle_cpu_signal -> page_unprotect -> > tb_invalidate_phys_page -> cpu_resume_from_signal will pass > a non-NULL puc. > > The cleanups are: > * pull the call to cpu_resume_from_signal() up through the > callstack so we do the signal mask manipulation in > handle_cpu_signal() > * drop the OS/CPU spceific code to get a signal mask out of > a usercontext, because in the specific case of handle_cpu_signal() > we already have the signal mask value and can just use it > * rename cpu_resume_from_signal() to cpu_loop_exit_noexc(), > since all the remaining callsites are not in fact signal handlers > or even called from signal handlers > * get rid of an ugly TARGET_I386 ifdef in user-exec.c by moving > the i386-specific code into its handle_mmu_fault hook. > > Changes v1->v2: > * patches 1-4 are the same and already reviewed > * patch 5 is new, and just adds a clarifying comment to > do_interrupt_user() > * patch 6 is the old patch 5, and now sets env->exception_next_eip > to -1 as a clear indication that the value is not going to be used > (as noted in the comment in the new patch 5) > > thanks > -- PMM > > > Peter Maydell (6): > translate-all.c: Don't pass puc, locked to tb_invalidate_phys_page() > user-exec: Push resume-from-signal code out to handle_cpu_signal() > cpu-exec: Rename cpu_resume_from_signal() to cpu_loop_exit_noexc() > user-exec: Don't reextract sigmask from usercontext pointer > target-i386: Add comment about do_interrupt_user() next_eip argument > target-i386: Move user-mode exception actions out of user-exec.c > > cpu-exec-common.c | 8 ++--- > exec.c | 2 +- > hw/i386/kvmvapic.c | 2 +- > include/exec/exec-all.h | 2 +- > target-i386/bpt_helper.c | 2 +- > target-i386/helper.c | 2 ++ > target-i386/seg_helper.c | 6 +++- > target-lm32/helper.c | 2 +- > target-s390x/helper.c | 2 +- > target-xtensa/helper.c | 2 +- > translate-all.c | 40 ++++++++++++--------- > translate-all.h | 2 +- > user-exec.c | 93 +++++++++++++++++++++--------------------------- > 13 files changed, 82 insertions(+), 83 deletions(-) > > -- > 1.9.1