Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp522336ybi; Fri, 7 Jun 2019 11:59:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyl+dotJzxKXfvg6IoRPipyCpJTJCwWV796irmcwimhAzof25qs5pUA+c2T5800ir6yytWz X-Received: by 2002:aa7:90d3:: with SMTP id k19mr58932759pfk.1.1559933950463; Fri, 07 Jun 2019 11:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559933950; cv=none; d=google.com; s=arc-20160816; b=dssFf+LNvD0+9vAhHpVGO+pKOwuxxl19Y7C6bEUiROtZQ8Ag5wecQzFmf0SuUcz0Ka bCvIbYg88YmjER7xoxmLOOU1mjFLAruWaVOBgq5wTiXXcXlm/K3fXydq4crGeMfEvu4M xl8x421h1QJI9EQQ1G1zz/NdJRDgHUWRSZ9DWlwJlIVuU2oxszwoOlfyc2ZSmT0gdFwC Bk/efF5BI5gJsneQlTmEMKWWTVfQHRUVdQcaHIYzOEKSQySIs5Dc3Ql3xzaOzeJTqJLJ rrjToM9LdGlLYlTocWEBStUlWmQFnvGwjc6NWdQFoIOMEgOcrri82nDvAg2FYPTF+gL5 /86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i7/otFLhJ3bDHgjDfO6mj7CHsE7BUGZdynbRLEhHFUQ=; b=eub/8H8WiLS8vRRE41Q8tZHPayPaX2qu/1PA+xp/2mLEND1U1PWk214rGBOqIEPDXL 20If6gpQ8VLbC83J6x04A3ohS0nVjtAkmSDsqlLHBwEp0xoeyoIV9QIbERSql92hyxkN stQwmx/buUaRC9iJlQKPQzVTrkD18uiO9Sc1ixwiuktdNYXpKJ2WAX6GkBLdo/O06z45 TtLARwutLcHDlcoVogZNMTEtNWzL7WllI6C9Jcqz7syzAObNGj2QxFpyvXO4ApCa0Dbo qW9TdTYxPyPotC+0J5vW8OYI7giJ7w6PhnbDmRqnWhOvkhAmgeflbkk6JX6zA5NJLvzJ vwoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="bS9qEaH/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12si2652614pll.196.2019.06.07.11.58.54; Fri, 07 Jun 2019 11:59:10 -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=@linux-foundation.org header.s=google header.b="bS9qEaH/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730942AbfFGRs0 (ORCPT + 99 others); Fri, 7 Jun 2019 13:48:26 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:37154 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728684AbfFGRs0 (ORCPT ); Fri, 7 Jun 2019 13:48:26 -0400 Received: by mail-lf1-f68.google.com with SMTP id m15so2257140lfh.4 for ; Fri, 07 Jun 2019 10:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i7/otFLhJ3bDHgjDfO6mj7CHsE7BUGZdynbRLEhHFUQ=; b=bS9qEaH/73TPk8ga/eF/YyZ737I0ef7FUTSLE99EhdCnXv6YIbVGezMaX/eEd+xlcD ser1nRz6S0lRSXjtod9Lb8kOYRftd8H1I24RE2bO6B8NweysAqC1P4GkPElOkBexIIkL wnj9Y6t62H8vqO7RCIiQD3sjYJTXvtBXqZ57k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i7/otFLhJ3bDHgjDfO6mj7CHsE7BUGZdynbRLEhHFUQ=; b=KQ5ibC2BtYLKIEhgC2ue+pd4JLvviNxkL+JhM9OmaeSr+JO2LnqOBSGgxjCphP/3D2 GltDarzqfzvkEfrcEpAogi5EkbuikVAQC3ShfmiN6M48rr1WTjFJumBYKPg227w5eXa/ 3ps3K50NJSF75AEqBOiEuh78/jKeCggIVcXCO68WRmNnKAzQp4ReDfDrDZ65CSFY8/WM 6V7ZCxcKyGCEL+EbXi8e2JwahsJb3rqn+iGj/oxeqZlzI0DysmFwKjElBdZehVFLe4H3 acU1kE2Wg0S12JSLEvTdJwPfVHX98Kr77SqA9fi6uo5Wg9KabBYgAHVsHcXHOA5bpJBk CcZg== X-Gm-Message-State: APjAAAVqgWQg9S+NQ7oCzNL0KOCOUuasexRVLho123lHohwugo84PKom eAo56BlGvU0W+eisOdY+uxw5oIhWbVI= X-Received: by 2002:ac2:5ec6:: with SMTP id d6mr29683822lfq.131.1559929703358; Fri, 07 Jun 2019 10:48:23 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id x19sm489463ljb.6.2019.06.07.10.48.22 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 10:48:22 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id y198so2273661lfa.1 for ; Fri, 07 Jun 2019 10:48:22 -0700 (PDT) X-Received: by 2002:ac2:4565:: with SMTP id k5mr23954642lfm.170.1559929701965; Fri, 07 Jun 2019 10:48:21 -0700 (PDT) MIME-Version: 1.0 References: <20190605130753.327195108@infradead.org> <20190605131945.005681046@infradead.org> <20190608004708.7646b287151cf613838ce05f@kernel.org> <20190607173427.GK3436@hirez.programming.kicks-ass.net> In-Reply-To: <20190607173427.GK3436@hirez.programming.kicks-ass.net> From: Linus Torvalds Date: Fri, 7 Jun 2019 10:48:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 08/15] x86/alternatives: Teach text_poke_bp() to emulate instructions To: Peter Zijlstra Cc: Masami Hiramatsu , "the arch/x86 maintainers" , Linux List Kernel Mailing , Ard Biesheuvel , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Nadav Amit , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 7, 2019 at 10:34 AM Peter Zijlstra wrote: > > I was/am lazy and didn't want to deal with: > > arch/x86/include/asm/nops.h:#define GENERIC_NOP5_ATOMIC NOP_DS_PREFIX,GENERIC_NOP4 > arch/x86/include/asm/nops.h:#define K8_NOP5_ATOMIC 0x66,K8_NOP4 > arch/x86/include/asm/nops.h:#define K7_NOP5_ATOMIC NOP_DS_PREFIX,K7_NOP4 > arch/x86/include/asm/nops.h:#define P6_NOP5_ATOMIC P6_NOP5 Ugh. Maybe we could just pick one atomic sequence, and not have the magic atomic nops be dynamic. It's essentially what STATIC_KEY_INIT_NOP #define seems to do anyway. NOP5_ATOMIC is already special, and not used for the normal nop rewriting, only for kprobe/jump_label/ftrace. So I suspect we could just replace all cases of ideal_nops[NOP_ATOMIC5] with STATIC_KEY_INIT_NOP and get rid of the whole "let's optimize the atomic 5-byte nop" entirely. Hmm? By definition, NOP_ATOMIC5 is just a single nop anyway, it's not used for the potentially more complex alternative rewriting cases. Linus