From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753640AbcHQTgF (ORCPT ); Wed, 17 Aug 2016 15:36:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43880 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752834AbcHQTgD (ORCPT ); Wed, 17 Aug 2016 15:36:03 -0400 Subject: Re: RFC: Petition Intel/AMD to add POPF_IF insn To: Linus Torvalds References: <8de26c33-5597-bf00-2ac5-d265ba01d0d4@redhat.com> Cc: Andy Lutomirski , 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 From: Denys Vlasenko Message-ID: <4c31334b-4424-7660-5513-a601bfa763f3@redhat.com> Date: Wed, 17 Aug 2016 21:35:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 17 Aug 2016 19:36:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/17/2016 09:32 PM, Linus Torvalds wrote: > On Wed, Aug 17, 2016 at 12:26 PM, Denys Vlasenko wrote: >> >> Exactly. And more: > > All of which is ENTIRELY IRRELEVANT. > > The 2-page pseudo-code is about behavior. It's trivial to > short-circuit. There are obvious optimizations, which involve just > making the rare cases go slow and have a trivial "if those bits didn't > change, don't go through the expense of testing them". > > The problem is that IF is almost certainly right now in that rare case > mask, and so popf is stupidly slow for IF. I ran the test, see the first email in the thread. Experimentally, POPF is stupidly slow _always_. 6 cycles even if none of the "scary" flags are changed. Either: * its microcode has no rare case mask or * its microcode is so slow that even fast path is slow, and slow path is worse