Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4544422ybb; Tue, 7 Apr 2020 09:29:35 -0700 (PDT) X-Google-Smtp-Source: APiQypJ2ns9QtaENdAOD5o9UwIy1KfilJesZW5tsll9qRe5p4MSlQdcFGNLWIEKFuFD9kSOH/u4k X-Received: by 2002:a05:6808:8cb:: with SMTP id k11mr129477oij.48.1586276975812; Tue, 07 Apr 2020 09:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586276975; cv=none; d=google.com; s=arc-20160816; b=iNtpgW2958IcCajhHbTE081ZeQCqHGM4U31FCIrQSyj9ZGLfFj6ETaVUx1l+hfJ/ik GBw6W1GW9do1O5kWCDkMvuddn480/i8OEmDM7xv2bEQiT5bHz7zVXsds3eFkY9LAS9nY yKG3C2lI1tyExtEyd5uKdAqlkgZoLPtS1cUPLNGmNLsN8Yw/9sHSUEsZwkeD2pVA95Sj 2GJlO9ooG5nG77L5A2SQnkjRvKzpUfLwSKZEIW+fhBnBrSZzZFii6plr/d3YQdQ6psUR pCW3sJYU9Jr3UleCtCUsiNeQ0HYlCrxuKjIJvp1+xvFaS+THjz2mNoyXKKTo8b9u1W7Y VQtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8fuLk3L8ELTxwTSKiP3T5dmiYkZPR3qzEibGwB0sRWY=; b=bw7LcUgAQJoWCX5Nx2NrJeP1V81vJizyy/yx8K/B82ffFB11tk/ZzrBHG1Xh1mdjCw GB5b1YCorfAVtF3I1re5w3bHVzgtulLyVihNZkcMV1iqEhCYhVd1i69e2g8CHeeTszQH 9V6NGM6XVtBBJ5WJwUl+m0tLynsKkMMlwiL0GwX/p23wo59qEs/1Z5Orn7Z/um7r2s2v +cO3iiM7WaYD04TY7iKKxAG+WobkiGvJ6Q40HfQIWRdKNN2Cgbh6t1puLrBdUTt2NU1T ZUAeamSlGIjQTlXictFz+7CfKHe/nAsL/H8n4sf+sBKN4M3q7IXNiUJgMLGNEnlcstFf WiqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KHsjYgQU; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 96si1482932oty.198.2020.04.07.09.29.23; Tue, 07 Apr 2020 09:29:35 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=KHsjYgQU; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727874AbgDGQ2r (ORCPT + 99 others); Tue, 7 Apr 2020 12:28:47 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43322 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726776AbgDGQ2q (ORCPT ); Tue, 7 Apr 2020 12:28:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586276926; 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: in-reply-to:in-reply-to:references:references; bh=8fuLk3L8ELTxwTSKiP3T5dmiYkZPR3qzEibGwB0sRWY=; b=KHsjYgQUQQPufUN3cQL/d6YVE4QVr9o6ycNfW7zPEuJwMaAvlxtdtIzMSmAs4BskNA3nCa 4YFKfPM8qLerbwTNCsIAfC1i+nbxAR7mA3e34E5LsJZSesskB6On7vcGCmRwbIcjvJ4Qdg DV5X0OtLS1hrS/jITWLVOA8M03P7hHc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-TEwEXIKEN1i_4ybstAbp-w-1; Tue, 07 Apr 2020 12:28:43 -0400 X-MC-Unique: TEwEXIKEN1i_4ybstAbp-w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35920800D50; Tue, 7 Apr 2020 16:28:42 +0000 (UTC) Received: from treble (ovpn-116-24.rdu2.redhat.com [10.10.116.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C549E60BF7; Tue, 7 Apr 2020 16:28:40 +0000 (UTC) Date: Tue, 7 Apr 2020 11:28:38 -0500 From: Josh Poimboeuf To: Alexandre Chartre Cc: Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org, jthierry@redhat.com, tglx@linutronix.de Subject: Re: [PATCH V2 9/9] x86/speculation: Remove all ANNOTATE_NOSPEC_ALTERNATIVE directives Message-ID: <20200407162838.5hlh6oom4oa45ugt@treble> References: <20200407073142.20659-1-alexandre.chartre@oracle.com> <20200407073142.20659-10-alexandre.chartre@oracle.com> <20200407132837.GA20730@hirez.programming.kicks-ass.net> <20200407133454.n55u5nx33ruj73gx@treble> <89b10eb8-c030-b954-6be3-8830fc6a8daa@oracle.com> <3eb36fd2-9827-4c1b-681c-9c1d65c7582f@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3eb36fd2-9827-4c1b-681c-9c1d65c7582f@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 07, 2020 at 06:18:51PM +0200, Alexandre Chartre wrote: > > On 4/7/20 4:32 PM, Alexandre Chartre wrote: > > > > On 4/7/20 3:34 PM, Josh Poimboeuf wrote: > > > On Tue, Apr 07, 2020 at 03:28:37PM +0200, Peter Zijlstra wrote: > > > > Josh, we should probably have objtool verify it doesn't emit ORC entries > > > > in alternative ranges. > > > > > > Agreed, it might be as simple as checking for insn->alt_group in the > > > INSN_STACK check or in update_insn_state(). > > > > > > > We could do that only for the "objtool orc generate" command. That way > > "objtool check" would still check the alternative, but "objtool orc generate" > > will just use the first half of the alternative (like it does today with > > ANNOTATE_NOSPEC_ALTERNATIVE). We can even keep all ANNOTATE_NOSPEC_ALTERNATIVE > > but only use them for "objtool orc generate". > > > > I have checked and objtool doesn't emit ORC entries for alternative: > decode_instructions() doesn't mark such section with sec->text = true > so create_orc_sections() doesn't emit corresponding ORC entries. > > So I think we can remove the ANNOTATE_NOSPEC_ALTERNATIVE directives, > this will allow objtool to check the instructions but it still won't > emit ORC entries (same behavior as today). In the future, if ORC > eventually supports alternative we will be ready to have objtool emit > ORC entries. What's the benefit of removing ANNOTATE_NOSPEC_ALTERNATIVE if there's no ORC support to go along with it? Also I want to avoid adding "ORC alternatives". ORC is nice and simple and we should keep it that way as much as possible. Again, we should warn on stack changes inside alternatives, and then look at converting RSB and retpolines to use static branches so they have deterministic stacks. -- Josh