Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5160774imb; Thu, 7 Mar 2019 09:03:42 -0800 (PST) X-Google-Smtp-Source: APXvYqx2zwNNSjDoSWKX6G85WKaqeq268+IFM5YbsG+nfaOjiVBhI8pztAK8U6dFBQEQmGDW4bg1 X-Received: by 2002:a17:902:a7:: with SMTP id a36mr13980294pla.267.1551978222029; Thu, 07 Mar 2019 09:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551978222; cv=none; d=google.com; s=arc-20160816; b=nsQA+INY+gvnKcRPZvUPdMze7JmhRIk05/4iSBRLs1D52YStDt1tZ4wSxItJ+dEPMx RmaI0hpDUG+zER+EAGRbmOzG0tlVtgBuJLVQSuPQeK094WT78f6Cj44r7TplzU/Kfd7B ayrpwZiMx6U/Ayv7yYnaVAMOqj2b2KE5QhLQ4/kRsTPPa0GecmNiuVDaVFLSEX72B7zf XlzwW/LilzTX+R3X3WHUDt6/ed5K0t2t3LRYrp4yJ5ctSlXuBiu2N//3hcOlg1g+zlO/ b+J9zLrWjgnh6GUV/0RUL9d8/qm7+GPvueYN00dbTiy9pdJjyCjsRuif/rxgDTpfSnSe aAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=y3qq1FJAtgMcBrhxJOuu6fPyW4x/qy6rfTwk7P7bdN4=; b=TrCVOZMr3pkhIYfQ1Sv2V7anr7omGdKs7ty7f46JUVp0U2Xp/lz1BHMY5OoGCowCyL MbdAckHHcJO5YecC88BhUk2BQpYx1fU6A2c1en9MX9ZIq4oHp6qJRiiPCOkEVYYXhMTk sPQoXbIhzP+CLGGb85H/KevM4QoBDHd6KIsLVMF1YOYRAePFmqa4jibUBdbdhLSNXWXP /A2j+Kr0T3HvLLCYrSp2q7VwybRM9tY3P+VQYRzQYMeRX69OKEtzjCCK/B618NIlXOgb DWsE0m5W/TpO7yH6ffi3CCyHuLeRDSCFbRMjcp1Y/lIUiByY8a/uHqwNAUHN1cuk7aYi 4+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=MMTf+qM5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v71si4136820pgd.499.2019.03.07.09.03.25; Thu, 07 Mar 2019 09:03:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=MMTf+qM5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbfCGRCy (ORCPT + 99 others); Thu, 7 Mar 2019 12:02:54 -0500 Received: from mail.skyhub.de ([5.9.137.197]:53568 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbfCGRCy (ORCPT ); Thu, 7 Mar 2019 12:02:54 -0500 Received: from zn.tnic (unknown [IPv6:2003:ec:2f08:1c00:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 71BE81EC066F; Thu, 7 Mar 2019 18:02:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1551978171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=y3qq1FJAtgMcBrhxJOuu6fPyW4x/qy6rfTwk7P7bdN4=; b=MMTf+qM5o5XuoSWwaEXahf1r1N0Uzibm438tZBQJCyJa28wh0t3NHqV9+LCJc/KAUVt0F4 /cYa61X4/5ES4JmSh89MXAEWV0xafzdCuIDLPjbWxu4Gu8NVU7b7/xRFzc2AGidX/jTp7x sA46QeeJG2aL3u03dxDA5CCVDdKx6F0= Date: Thu, 7 Mar 2019 18:02:54 +0100 From: Borislav Petkov To: hpa@zytor.com Cc: Nadav Amit , Rick Edgecombe , Andy Lutomirski , Ingo Molnar , LKML , X86 ML , Thomas Gleixner , Dave Hansen , Peter Zijlstra , Damian Tometzki , linux-integrity , LSM List , Andrew Morton , Kernel Hardening , Linux-MM , Will Deacon , Ard Biesheuvel , Kristen Carlson Accardi , "Dock, Deneen T" , Kees Cook , Dave Hansen , Masami Hiramatsu , Michael Matz Subject: Re: [PATCH] x86/cpufeature: Remove __pure attribute to _static_cpu_has() Message-ID: <20190307170254.GF26566@zn.tnic> References: <20190211182956.GN19618@zn.tnic> <1533F2BB-2284-499B-9912-6D74D0B87BC1@gmail.com> <20190211190108.GP19618@zn.tnic> <20190211191059.GR19618@zn.tnic> <3996E3F9-92D2-4561-84E9-68B43AC60F43@gmail.com> <20190211194251.GS19618@zn.tnic> <20190307151036.GD26566@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lemme preface this by saying that I've talked to gcc guys before doing this. On Thu, Mar 07, 2019 at 08:43:50AM -0800, hpa@zytor.com wrote: > Uhm... (a) it is correct, even if the compiler doesn't use it now, it > allows the compiler to CSE it in the future; Well, the compiler won't CSE asm blocks due to the difference in the labels, for example, so the heuristic won't detect them as equivalent blocks. Also, compiler guys said that they might consider inlining pure functions later, in the IPA stage but that's future stuff. This is how I understood it, at least. > (b) it is documentation; That could be a comment instead. Otherwise we will wonder again why this is marked pure. > (c) there is an actual bug here: the "volatile" implies a side effect, > which in reality is not present, inhibiting CSE. > > So the correct fix is to remove "volatile", not remove "__pure". There's not really a volatile there: /* * GCC 'asm goto' miscompiles certain code sequences: * * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 * * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. * * (asm goto is automatically volatile - the naming reflects this.) */ #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.