From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753429AbcHQWi5 (ORCPT ); Wed, 17 Aug 2016 18:38:57 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35478 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752834AbcHQWi4 (ORCPT ); Wed, 17 Aug 2016 18:38:56 -0400 MIME-Version: 1.0 In-Reply-To: References: <8de26c33-5597-bf00-2ac5-d265ba01d0d4@redhat.com> From: Linus Torvalds Date: Wed, 17 Aug 2016 14:48:00 -0700 X-Google-Sender-Auth: PYuTEs-OGkzZhQ9xASY-gOQsSxA Message-ID: Subject: Re: RFC: Petition Intel/AMD to add POPF_IF insn To: Andy Lutomirski Cc: Denys Vlasenko , Sara Sharon , Dan Williams , =?UTF-8?Q?Christian_K=C3=B6nig?= , Vinod Koul , Alex Deucher , Johannes Berg , "Rafael J. Wysocki" , Andy Lutomirski , "the arch/x86 maintainers" , Ingo Molnar , LKML , Adrian Hunter Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 17, 2016 at 2:43 PM, Andy Lutomirski wrote: > > It shouldn't be *too* bad, since xen_restore_fl only affects "IF". > And even if native_restore_fl needs to be able to turn IRQs off as > well as on, we can just do: > > if (likely(flags & X86_EFLAGS_IF)) > sti(); > else > cli(); > > at some cost to code size but hopefully little to no runtime cost for > the sane cases. No, that would be horrible for the case where we had an irq spinlock in an irq-region. Then we'd have a pointless "cli" there. So I'd rather just make sure that only the spinlock code actually uses native_restore_fl(). And yes, the patch works at least minimally, since I'm writing this with a kernel compiled with that. Of course, somebody really should do timings on modern CPU's (in cpl0, comparing native_fl() that enables interrupts with a popf) Linus