Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3504819imu; Sun, 11 Nov 2018 16:37:55 -0800 (PST) X-Google-Smtp-Source: AJdET5eGbiue0e2OYlXhS+HA4imDkkT0L0WgFJeoT0v4e/FQMr2dqqUCxXc2jC7zpxEUBXIuFLnF X-Received: by 2002:a63:525e:: with SMTP id s30-v6mr15673852pgl.436.1541983075711; Sun, 11 Nov 2018 16:37:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541983075; cv=none; d=google.com; s=arc-20160816; b=TYhGPjzbr/jJ3aODCUBUjv1CvnRLc9iU+Elx+eoxrZdIZbQVG3M0VtwnzonCx4pnd3 czzLYu1iG7uiJNSpw5grgpNJQkW2pgYfNzt5k2oTHLQUCIbrluVWE6Obplwwl3ty6pU1 KwrV1FZGLLv3zFrefYpXDNM4BVY7QGv22RvAm1hpGJt3OHBW2s/JDYde7WYRRFFGs4Xz 9gYR4sp8gOAl9siehxeQ3Qv8sDqoIb/M7ExN4rmSdU/H0IdNOByErXHrsdW3NL1QOdlr FTukC0gfSoXwlmLBeAiU2A96WDdf579FbgDRXjr+dpN/wYFrLNVatNTpD5UxuX8FGFky 0weQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pzpoDWHhT7ek0tQS7IcyOew/G2DS0MvOWPxB8UkCUDo=; b=t/ivQU8C6pHLUNW4hRX/6qEwIZxJ1RdxdXEMV7f6vU/1bMAO86kC4Pb9fXNbxgcM3e gSve89+PuJXmyw18sZwcdeG/nxM9JciJ+95wGmF5zoZOc72QCbVhaX+RY5F/D+9FQNTp X+xmmhQSLMQvqXEjAyId+sAxvji3yBZAylU6MwvbEscTENXYg+q19Wgzi0KaF9JcpH5h Zm4hct9BJ0Q33b6HNfZsGp624eJuCGImfInrOoERtS/ndu3McjGDQ6yXAEMFk2p6rHj+ r+ZZ6V18FlA7ocxMMK3qeG2Ez9DfsuVVX85I9fFEfbjcgltrBVUdEJ8usPMXSq1nN1Lc rmYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=XCznycJ6; 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 o9-v6si6001863plk.434.2018.11.11.16.37.40; Sun, 11 Nov 2018 16:37:55 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=XCznycJ6; 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 S1730216AbeKLK1X (ORCPT + 99 others); Mon, 12 Nov 2018 05:27:23 -0500 Received: from merlin.infradead.org ([205.233.59.134]:35318 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729482AbeKLK1X (ORCPT ); Mon, 12 Nov 2018 05:27:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pzpoDWHhT7ek0tQS7IcyOew/G2DS0MvOWPxB8UkCUDo=; b=XCznycJ6e4KEyqWZUxBnAherQ8 f8Sh1QV43lDk8t1pGI9NKMtSvwMl4rcxB/jmBusPGkE9+yuv4NGpyU0/GKxU3vperh1XEu4+fUbAP or5FUnMer3GtSL8FWbPAqNIiaEn8vDGQsi+RTI2HJoXhB6/t6ms6AMvM/4vdM2hR7SZNrcxXqdoTg jKd1zpq4zQNrr+0QWW5W6+hkRhQ2hWzdXcLW22MLbQSn5jVrxef3o98Llkki9A1S5n1tJ1wVmfVxw eqggsexVtyKyRuK2FM6thSdZZCUJank44Vo2L+uiJ9KbuR9z3609wdV6Gkdb8/EKM1j+auc+L6Qne v9dpDPIg==; Received: from [64.114.255.97] (helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gM0DX-0004WC-EF; Mon, 12 Nov 2018 00:36:39 +0000 Received: by worktop (Postfix, from userid 1000) id 8CECA6E061A; Mon, 12 Nov 2018 01:36:38 +0100 (CET) Date: Mon, 12 Nov 2018 01:36:38 +0100 From: Peter Zijlstra To: Nadav Amit Cc: Ingo Molnar , LKML , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Borislav Petkov , Dave Hansen , Andy Lutomirski , Kees Cook , Dave Hansen , Masami Hiramatsu Subject: Re: [PATCH v4 06/10] x86/alternative: use temporary mm for text poking Message-ID: <20181112003638.GA3082@worktop> References: <20181110231732.15060-1-namit@vmware.com> <20181110231732.15060-7-namit@vmware.com> <20181111145936.GA3021@worktop> <43C8C690-F079-4513-82CD-46A62DBA5A3B@vmware.com> <20181111235220.GB3056@worktop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181111235220.GB3056@worktop> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 12:52:20AM +0100, Peter Zijlstra wrote: > On Sun, Nov 11, 2018 at 08:53:07PM +0000, Nadav Amit wrote: > > > >> + /* > > >> + * The lock is not really needed, but this allows to avoid open-coding. > > >> + */ > > >> + ptep = get_locked_pte(poking_mm, poking_addr, &ptl); > > >> + > > >> + /* > > >> + * If we failed to allocate a PTE, fail. This should *never* happen, > > >> + * since we preallocate the PTE. > > >> + */ > > >> + if (WARN_ON_ONCE(!ptep)) > > >> + goto out; > > > > > > Since we hard rely on init getting that right; can't we simply get rid > > > of this? > > If it is about the way the source code looks - I guess it doesn’t sore my > > eyes as hard as some other stuff, and I cannot do much about it (other than > > removing it as you asked). FWIW per the same argument we should be checking if poking_mm is !NULL. We also don't do that.