From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758360AbbIDHkx (ORCPT ); Fri, 4 Sep 2015 03:40:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41577 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755326AbbIDHkv (ORCPT ); Fri, 4 Sep 2015 03:40:51 -0400 Date: Fri, 4 Sep 2015 08:40:49 +0100 From: "Richard W.M. Jones" To: Thomas Gleixner Cc: Borislav Petkov , Chuck Ebbert , linux-kernel@vger.kernel.org, x86@kernel.org, Ingo Molnar , "H. Peter Anvin" Subject: Re: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler Message-ID: <20150904074049.GM29283@redhat.com> References: <20150830223757.6e4c5c02@as> <20150901062022.GA19002@redhat.com> <20150903085046.GA19397@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 03, 2015 at 12:41:47PM +0200, Thomas Gleixner wrote: > On Thu, 3 Sep 2015, Borislav Petkov wrote: > > On Wed, Sep 02, 2015 at 11:11:55AM +0200, Thomas Gleixner wrote: > > > static void __init_or_module add_nops(void *insns, unsigned int len) > > > { > > > + unsigned long flags; > > > + > > > + local_irq_save(flags); > > > while (len > 0) { > > > > I guess you want to optimize the len==0 case to not disable interrupts > > needlessly: > > > > if (!len) > > return; > > > > local_irq_save(flags); > > while (len > 0) > > ... > > Nah. I rather put the local_irq_save into optimize_nops(). All other > callers of add_nops() are operating on a buffer and use text_poke > after that. Aside of that optimize_nops() is missing a sync_core(). > > Updated patch below. V2 of the patch managed ~ 5000 iterations overnight without hitting the problem, so looks like it's a good fix. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top