From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753287AbbGXKZP (ORCPT ); Fri, 24 Jul 2015 06:25:15 -0400 Received: from mail.skyhub.de ([78.46.96.112]:33220 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbbGXKZK (ORCPT ); Fri, 24 Jul 2015 06:25:10 -0400 Date: Fri, 24 Jul 2015 12:25:03 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: Andy Lutomirski , X86 ML , "linux-kernel@vger.kernel.org" , Brian Gerst , Steven Rostedt , Willy Tarreau , Thomas Gleixner , Peter Zijlstra , Linus Torvalds Subject: Re: [PATCH 1/3] x86/entry/64: Refactor IRQ stacks and make then NMI-safe Message-ID: <20150724102503.GA19090@nazgul.tnic> References: <040374ca9800988a0ed35ea9ddeb4a762c1371fa.1437690860.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 23, 2015 at 11:08:39PM -0700, Andy Lutomirski wrote: > To be obviously safe against any local exception, we want a single > instruction that will change %rsp and some in-memory flag at the same > time. There aren't a whole lot of candidates. Cmpxchg isn't useful > (cmpxchg with a memory operand doesn't modify its register operand). Why would you even need that? You do LOCK; CMPXCHG on a per_cpu variable and then test ZF? I.e., use it as a mutex in asm. With ZF=1, you switch stacks, with ZF=0, you busy-wait ... Or am I missing something? This way you serialize all irq stack switchers... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --