Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp651571imm; Wed, 29 Aug 2018 08:49:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbUohHyME2wS9oRS6Oo7iLGZOvbC7BYf30qskj0L5Cw77T+K07d1QRAzdz86+FsxoyjsQ0L X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr6493405plt.237.1535557751895; Wed, 29 Aug 2018 08:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535557751; cv=none; d=google.com; s=arc-20160816; b=Hs8FKzdfgOl4wI7yjO8BzIPg08bUhohkg7XIxSqi/Yv+vt+VJKIBwFgUDk1TldMXvH V09MHaup/M7Ric39rH7/hAAgbrRLQd+BiaTED5DKmIKgPjCXXDGgfKdqTNdscRjkIVaZ /cHLS7h4KwNuvvm0LWnqOMuJwZiNAhTzwstWJZ2GDsTby15mMCScF+yz/IZ2Oipk4oph FWtaTMAqs/gwhpmyCCkV4900RX+9FgY9ABc+eu8q8decke/Zyfq8t1V1LQedD3M4ni4k oZm8xiyXdvnHBPLUEXw1qO7OZciK/1NybQXlH823f2NY5uyJ4MJEZWtt5o228VVPTrss 0IpA== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=3vXTv2HQUtQM4UgYYditao+fGdqyKCGPuR71QL6TT8Y=; b=Y8LTw9/2ux+ondkst9IvoCGkoMVR9hqXNNV3IzHolnCGMj3dv4mujnNCbo8ZAtOW5O fpPeIk7FogjZh3xANoQ0f0hWogDtvX/U3G4DFW65MxOncgn3dGoUgGov8pPWDZvCxFRH jnu3Wq+pVvSQmvY+eozqBRk5DnUhEhQohFBw7HaFk9l3fensAXGV6VNyOFFQwMsRdBqS 9MhqEqm6NhS81VOpsiukZoQE7Ne5KbJRGaq3/C9S80Ikn6+aV27bBaW351p57dIVLCuZ upn6Fylnz19r8XXS9R4zkVDv0R8xLCpmAwPJz4fuACtjIw+y9zpr4qZ0phXaZTv9g5H/ o+Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GLzD/3tq"; 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 e8-v6si4081622pgu.347.2018.08.29.08.48.56; Wed, 29 Aug 2018 08:49:11 -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="GLzD/3tq"; 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 S1729181AbeH2Tn7 (ORCPT + 99 others); Wed, 29 Aug 2018 15:43:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:40140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729155AbeH2Tn7 (ORCPT ); Wed, 29 Aug 2018 15:43:59 -0400 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 7C6CF20673 for ; Wed, 29 Aug 2018 15:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535557586; bh=PK9WGLLrJeNyMLG6hPcbdroEOeNk5PB0RPmiM6roK7M=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=GLzD/3tqmaXhPuVr0UfXmQ1HrW0x9RyYWWNCIUEub6kk7qZ3XAD2+8VWIGrrhcxIF Bln71pp2uMBSwAEi1XNTk+2Z/WP1ID8vKIM9ceyBu0dBw0jVZLwbFesOHayEiJlqMk 3TyA46bWh3Huub5uy/cQWDDzP1ir2EiABEyVb4Zc= Received: by mail-wr1-f42.google.com with SMTP id a108-v6so5264572wrc.13 for ; Wed, 29 Aug 2018 08:46:26 -0700 (PDT) X-Gm-Message-State: APzg51BK84t6Dvne0QQX6GMva3VX5BpMrrXRsto3eUU08p9GhVfiloQW eAzr7FxE31p9/cu5m21SKU23a4oHSFTW353oOpTaSQ== X-Received: by 2002:adf:c98d:: with SMTP id f13-v6mr4909235wrh.148.1535557584952; Wed, 29 Aug 2018 08:46:24 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:548:0:0:0:0:0 with HTTP; Wed, 29 Aug 2018 08:46:04 -0700 (PDT) In-Reply-To: <20180829092839.GP24124@hirez.programming.kicks-ass.net> References: <20180829081147.184610-1-namit@vmware.com> <20180829081147.184610-6-namit@vmware.com> <20180829092839.GP24124@hirez.programming.kicks-ass.net> From: Andy Lutomirski Date: Wed, 29 Aug 2018 08:46:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 5/6] x86/alternatives: use temporary mm for text poking To: Peter Zijlstra Cc: Nadav Amit , Thomas Gleixner , LKML , Ingo Molnar , X86 ML , Arnd Bergmann , linux-arch , Andy Lutomirski , Masami Hiramatsu , Kees Cook 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 Wed, Aug 29, 2018 at 2:28 AM, Peter Zijlstra wrote: > On Wed, Aug 29, 2018 at 01:11:46AM -0700, Nadav Amit wrote: >> + pte_clear(poking_mm, poking_addr, ptep); >> + >> + /* >> + * __flush_tlb_one_user() performs a redundant TLB flush when PTI is on, >> + * as it also flushes the corresponding "user" address spaces, which >> + * does not exist. >> + * >> + * Poking, however, is already very inefficient since it does not try to >> + * batch updates, so we ignore this problem for the time being. >> + * >> + * Since the PTEs do not exist in other kernel address-spaces, we do >> + * not use __flush_tlb_one_kernel(), which when PTI is on would cause >> + * more unwarranted TLB flushes. >> + */ > > yuck :-), but yeah. I'm sure we covered this ad nauseum when PTI was being developed, but we were kind of in a rush, so: Why do we do INVPCID at all? The fallback path for non-INVPCID systems uses invalidate_user_asid(), which should be faster than the invpcid path. And doesn't do a redundant flush in this case. Can we just drop the INVPCID? While we're at it, we could drop X86_FEATURE_INVPCID_SINGLE entirely, since that's the only user. --Andy