Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1427522imm; Thu, 4 Oct 2018 13:29:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV60NYOuiW9Ci0Sa/qoqxARwN8CdLTNgzPI/ibwA41xr3r3XhnUXYRM6g4OH2DgkM+/Rb6VCw X-Received: by 2002:a62:8a4f:: with SMTP id y76-v6mr8584470pfd.142.1538684996196; Thu, 04 Oct 2018 13:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538684996; cv=none; d=google.com; s=arc-20160816; b=uSryA5JDlHAiYK/WTeUWpLxsCeTeL4CD+A9AYwSB9OppgL+CNAkhVuVnmEnok9w6gu FJIjze1l2XiWAUudXkJ2n8fK+AEQB1iFBD1HeFK5Vm8aOuxxKg4qNpjjnPKdOS6jGqg3 fZd9KSBAH5UbIyEqPN8WUwvYr3NwbNO8I8Mdl2eCF7Agr0kav2Yl/ODsM+6IyG+uudhi VppaGqco+jOPHv831bH7coyHSpTTSpUmTC8wWSeIC9GpVU8M3w4iwMjB0T2BUAQY0N1l Epw3w8B6Pbx0aucHWNbUSeRcIUwdEVwuu39BatN3T1S8CaC+8GK5y8Vbexgj7liX0PD0 IiLw== 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=8QQeIjkbv3IbrDcQowAKYhtKL0C1G4pxVLAKQf0HHCo=; b=g3s7ZKlNUnHr+xztLUzeIWtsF8CsfFX85VYwGQr0y6/0mdhWWza0CrO9E9tIpdZAzY mW4x8eC0EjaiUezNJ960NkN3ktHgt9EB8n6gWOK2CP5//WzwW8Eu/G1RK3vzyhBbWhyk lEkSU9N7UVO39ZRol7yCTi+PInmGoELM0dFxSqOhLb+5KhhBhfaebLdtQchv5CpXc91b 324Znd3OblpJbhDdQKf22PaXN9n5TqbLXk73E7FmS4pn2F37ti4LiM/6YJTO9cpnOWem +Aq+P+KBJ4yJdAMfft/YIsb9o2SxEmSQUqYao+Gd50Pfnt8op8LsQgt2GN4b8gWMyrA1 +XIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Apd+hKjm; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m29-v6si5371215pgd.361.2018.10.04.13.29.40; Thu, 04 Oct 2018 13:29:56 -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=@kernel.org header.s=default header.b=Apd+hKjm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbeJEDY3 (ORCPT + 99 others); Thu, 4 Oct 2018 23:24:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:50480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbeJEDY3 (ORCPT ); Thu, 4 Oct 2018 23:24:29 -0400 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E3BD621473 for ; Thu, 4 Oct 2018 20:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1538684974; bh=lriiZCSWyLRY6zxA+7n2JqZCh0J4iv9p6S31pW/+CWU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Apd+hKjmiQw8f8rQMuWp5nqw7873pkiDCr8BgVTDonzmdWJlSrEeb9xihy1vePSTi AcjaoG2/yuwALxfju5Ro3INBoJ3C880ECNx9vrzWULjKZCod4qNcsB9YMluZYE6eUA 7Df3AjVmgb8D0+9iEN1hjDfCQXqVu9sihy1kj+Z0= Received: by mail-wm1-f42.google.com with SMTP id 143-v6so10178168wmf.1 for ; Thu, 04 Oct 2018 13:29:33 -0700 (PDT) X-Gm-Message-State: ABuFfog1ukP4cI2dkLlKTCo9nVlFHlKnIwKwgvEFx2XL5NnvLyIUcFSt W9DfhEhM72HpDAs1ncWc8Vb90Ceg1scZzRMDgN3PSg== X-Received: by 2002:a1c:9355:: with SMTP id v82-v6mr5697550wmd.128.1538684972273; Thu, 04 Oct 2018 13:29:32 -0700 (PDT) MIME-Version: 1.0 References: <20181003213100.189959-1-namit@vmware.com> <20181003213100.189959-5-namit@vmware.com> <20181004075755.GA3353@gmail.com> <20181004083333.GA9802@gmail.com> <10D29A50-C352-4407-A824-0C3C06CD8592@zytor.com> <36D6F606-6922-4057-B1F8-2B30993962AE@zytor.com> <20181004091651.GB21151@gmail.com> In-Reply-To: From: Andy Lutomirski Date: Thu, 4 Oct 2018 13:29:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions To: "H. Peter Anvin" Cc: Ingo Molnar , Nadav Amit , Ingo Molnar , LKML , X86 ML , Thomas Gleixner , Jan Beulich , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Andrew Lutomirski 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 Thu, Oct 4, 2018 at 12:33 PM H. Peter Anvin wrote: > > On 10/04/18 02:16, Ingo Molnar wrote: > > > > * hpa@zytor.com wrote: > > > >> Ingo: I wasn't talking necessarily about the specifics of each bit, but rather the general > >> concept about being able to use macros in inlines... > > > > Ok, agreed about that part - and some of the patches did improve readability. > > > > Also, the 275 lines macros.s is a lot nicer than the 4,200 lines macros.S. > > > > Also, I'm not against using workarounds when the benefits are larger than the costs, but I am > > against *hiding* the fact that these are workarounds and that for some of them there are costs. > > > > Agreed, of course. > > >> I can send you something I have been working on in the background, but have been holding off > >> on because of this, in the morning my time. > > > > BTW., I have applied most of the series to tip:x86/kbuild already, and will push them out later > > today after some testing. I didn't apply the final 3 patches as they have dependencies, but > > applied the basics and fixed up the changelogs. > > > > So you can rely on this. > > > > Wonderful. > > Here is the horrible code I mentioned yesterday. This is about > implementing the immediate-patching framework that Linus and others have > discussed (it helps both performance and kernel hardening): > I'm wondering if a production version should look more like: patch_point: mov $whatever, [target] .pushsection ".immediate_patches" .quad .Lpatch_point .popsection and let objtool parse the resulting assembled output and emit an entry in some table mapping patch_point to the actual address and size of the immediate to be patched.