From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTomN-0006Qb-CK for qemu-devel@nongnu.org; Wed, 09 Oct 2013 04:06:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTomE-00051y-UM for qemu-devel@nongnu.org; Wed, 09 Oct 2013 04:05:59 -0400 Received: from mail-ea0-x230.google.com ([2a00:1450:4013:c01::230]:48718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTomE-00051h-Mk for qemu-devel@nongnu.org; Wed, 09 Oct 2013 04:05:50 -0400 Received: by mail-ea0-f176.google.com with SMTP id q16so199355ead.35 for ; Wed, 09 Oct 2013 01:05:49 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <52550E58.6030106@redhat.com> Date: Wed, 09 Oct 2013 10:05:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20131008004126.773017235@amt.cnet> <20131008004224.509422315@amt.cnet> <5253BC64.2060105@redhat.com> <20131008215155.GA16625@amt.cnet> In-Reply-To: <20131008215155.GA16625@amt.cnet> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [patch 1/2] qemu: mempath: prefault pages manually List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: qemu-devel@nongnu.org Il 08/10/2013 23:51, Marcelo Tosatti ha scritto: > On Tue, Oct 08, 2013 at 10:03:48AM +0200, Paolo Bonzini wrote: >> Il 08/10/2013 02:41, Marcelo Tosatti ha scritto: >>> + /* unblock SIGBUS */ >>> + pthread_sigmask(SIG_BLOCK, NULL, &oldset); >>> + sigemptyset(&set); >>> + sigaddset(&set, SIGBUS); >>> + pthread_sigmask(SIG_UNBLOCK, &set, NULL); >> >> Please instead modify qemu-thread-posix.c to unblock all per-thread >> signals (SIGBUS, SIGSEGV, SIGILL, SIGFPE and SIGSYS). There is no need >> to keep those blocked. > > main-loop.c handles SIGBUS via signalfd to emulate MCEs (associated > commits). Therefore it must be blocked. How was that tested? For BUS_MCEERR_AO it can work, but BUS_MCEERR_AR calls force_sig_info which does this: ignored = action->sa.sa_handler == SIG_IGN; blocked = sigismember(&t->blocked, sig); if (blocked || ignored) { action->sa.sa_handler = SIG_DFL; if (blocked) { sigdelset(&t->blocked, sig); recalc_sigpending_and_wake(t); } } if (action->sa.sa_handler == SIG_DFL) t->signal->flags &= ~SIGNAL_UNKILLABLE; and kills the process (because that's the default action of SIG_DFL). > Note that what this patch does it to maintain the signal handling state > (it saves the previous state, modifies state, restores previous state) so > that its unchanged. Yes, understood. I was missing the part about MCE (I knew it used SIGBUS, but forgot about signalfd). So this patch is good, but the above point about BUS_MCEERR_AR needs to be checked sooner or later. Paolo