From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbcHQSfK (ORCPT ); Wed, 17 Aug 2016 14:35:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41560 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbcHQSfJ (ORCPT ); Wed, 17 Aug 2016 14:35:09 -0400 Subject: Re: RFC: Petition Intel/AMD to add POPF_IF insn To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Ingo Molnar , Andy Lutomirski , Dan Williams , Alex Deucher , "Rafael J. Wysocki" , Vinod Koul , Johannes Berg , Sara Sharon , Adrian Hunter , Linus Torvalds References: <64bd8281-aeb4-391b-90c6-3f5e44f0ce07@amd.com> Cc: x86@kernel.org, LKML From: Denys Vlasenko Message-ID: <1a3e565b-1f27-dbd5-5111-ed87a1dc2aa0@redhat.com> Date: Wed, 17 Aug 2016 20:34:50 +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: <64bd8281-aeb4-391b-90c6-3f5e44f0ce07@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 17 Aug 2016 18:34:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/17/2016 07:30 PM, Christian König wrote: >> But in my measurements POPF is not fast even in the case where restored >> flags are not changed at all: >> >> mov $200*1000*1000, %eax >> pushf >> pop %rbx >> .balign 64 >> loop: push %rbx >> popf >> dec %eax >> jnz loop >> >> # perf stat -r20 ./popf_1g >> 4,929,012,093 cycles # 3.412 GHz ( +- 0.02% ) >> 835,721,371 instructions # 0.17 insn per cycle ( +- 0.02% ) >> 1.446185359 seconds time elapsed ( +- 0.46% ) >> >> If I replace POPF with a pop into an unused register, I get this: > > You are comparing apples and bananas here. Yes, I know. Pop into a register here is basically free. I'd also add a STI and measure how much it takes to enable interrupts, but unfortunately STI throws a #GP in CPL 3.