Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2295077pxp; Mon, 21 Mar 2022 16:08:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLaek19A86/1FIel7sqxGNVfMTbVgceSOib2UX5YolUMZV6iZok1+HJCgtZESocvtdCqWS X-Received: by 2002:a17:90b:4c4e:b0:1c7:4c0f:7c77 with SMTP id np14-20020a17090b4c4e00b001c74c0f7c77mr1567418pjb.222.1647904132523; Mon, 21 Mar 2022 16:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647904132; cv=none; d=google.com; s=arc-20160816; b=yezSAFXus3dpSj5kQPs2iTwZTd7rOcatPncZuvHLZzf9SGolguls0V0fVzL/nZCCUm +hT35omVQDYb7EqzL5o5ggwQw1UrmmtJeIsriLCWxmgRejX7EPFZ9MTqt/3nIiycNtzK mDWRSgZI2rSO00SsMio7xRqOnD+2qQEqqe0kKct+t8gLkAReWRq5OodFKgnen4JTdUsV DYvl67urQULr/nuaHzecHtMLaE2dtbhv4i2SdGV7XZJmqetllhGbSFyzI0G/hFuMWZDc ek7y4xjPki0XtHNlHroM06j2XF93zkimCd4HkDPs7WLMLtPaXXKb2kKRomSirDa3WHkd WvaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature:dkim-filter; bh=svb/lgQXEzjEPgFnj7j1DJy4Iq5vz9ytaGKdBRZvYko=; b=OfdSJ3f+KILQnsaLhoZXGSDSew+LXLc4MlY9q7OxsjoCeyltoZBWR/yNmXZzoEQDot XZMSV8i3dyrbnQ28yoExkpxD/5u/qujWhJu7jHuhBwze23a3sPCHIrG5xhfJoslC71EF OvwetQEVHMJieO9LtU5ASCDQmghzHytY/7G26nZPM2+g6BnBEOAwkr9kJhxrTYNdm11y gtgzSZhb8dCgxfmKjsoRP6AQaR7V/Tb64nJqycAfuGIBgODi3R7hY7Vc3Zbn2iNKmc5O BloJaab+DFGSBQMgGVGXMMXmUMk+H4/IAEJ23AFSj8lcBbTKhAvrJTBgdVfK/SCC98S6 cjzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2022030301 header.b=bTlBuu+s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k191-20020a6284c8000000b004fa3a8e007asi8552094pfd.305.2022.03.21.16.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:08:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail header.i=@zytor.com header.s=2022030301 header.b=bTlBuu+s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E58F425584; Mon, 21 Mar 2022 15:07:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234425AbiCRXFA (ORCPT + 99 others); Fri, 18 Mar 2022 19:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238197AbiCRXE7 (ORCPT ); Fri, 18 Mar 2022 19:04:59 -0400 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F57E9C93; Fri, 18 Mar 2022 16:03:39 -0700 (PDT) Received: from [IPv6:::1] ([IPv6:2601:646:8600:40c1:8f0c:2533:51ff:d719]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.15.2) with ESMTPSA id 22IN36PG1022936 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Fri, 18 Mar 2022 16:03:07 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 22IN36PG1022936 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2022030301; t=1647644587; bh=svb/lgQXEzjEPgFnj7j1DJy4Iq5vz9ytaGKdBRZvYko=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=bTlBuu+sxs0JshNvGQ3E+y9m/Xuz8dwiLyY+4q3DXXgPM+fnIbGU+MrR3G+OaRy/f bx0IiUAGeRjEQdVq/J5bCDkEudRK4+mlTQO15QkG+smtmr4QeUpncwoGZ5UPk8D6n0 ioY5oZG34neIzvJJgJ+3XC+z8wcnI2N3X9ze6yeUd5MZzM7zkkNS0oOqWKU9aGJ+9a 4gqt5VAmjtWwVfFf1Z+SrsJzYDuGPg8t82hbTOijcDGbdTXnMobW1CJvFz2r+pCAzL w0+tk1JlrNSvoxPleYrkG9U+tBYksKJu3vc/Po7R+SLx2Hs1jodCuoPsXgwlz7zDOz GjFceMUiJgd5g== Date: Fri, 18 Mar 2022 16:03:01 -0700 From: "H. Peter Anvin" To: David Laight , "'Linus Torvalds'" , Andy Lutomirski CC: Andrew Cooper , Nick Desaulniers , Bill Wendling , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Nathan Chancellor , Juergen Gross , Peter Zijlstra , "llvm@lists.linux.dev" , LKML , linux-toolchains Subject: RE: [PATCH v5] x86: use builtins to read eflags User-Agent: K-9 Mail for Android In-Reply-To: <5794cceec50a4f1ebca069d5a31afcdf@AcuMS.aculab.com> References: <20220210223134.233757-1-morbo@google.com> <20220301201903.4113977-1-morbo@google.com> <83b33afc-8502-0065-60bc-3a91528632d8@kernel.org> <5794cceec50a4f1ebca069d5a31afcdf@AcuMS.aculab.com> Message-ID: <8B69D1BF-8369-42EC-B0ED-DED038966FC9@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On March 18, 2022 3:43:13 PM PDT, David Laight wrote: >From: Linus Torvalds >> Sent: 18 March 2022 18:19 >>=20 >> On Fri, Mar 18, 2022 at 10:59 AM Andy Lutomirski wr= ote: >> > >> > I generally agree=2E In this particular case, though, I will keep us= ing >> > the builtin in tools/testing/selftests/x86/helpers=2Eh unless we actu= ally >> > hit breakage=2E This is because this is *user* code, it is compiled = with >> > the redzone enabled, and the asm code to do the right thing when the >> > redzone is enabled is too hairy for me to want to deal with it=2E >>=20 >> Yeah, redzoning is a problem for "pushf"=2E >>=20 >> Or rather, it's not the redzoning itself, but the fact that the >> compiler might use the word under the stack for random other things, >> and the pushf will then corrupt some local variable storage=2E >>=20 >> I think it would be lovely to solve that in inline asm itself some way >> - by marking the stack pointer clobbered or something=2E > >Something that generates: > mov %rax,-8(%rsp) > pushf > xchg %rax,0(%rsp) > add %rsp,8 >should work with or without a redzone=2E >Will be a bit slower :-( > > David > >- >Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1= 1PT, UK >Registration No: 1397386 (Wales) > *Much* slower (XCHG is implicitly locked, for hysterical raisins) and you = are using the redzone between the mov and the push, so it seems like you ju= st made things worse for no reason=2E