Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp741179ybm; Wed, 22 May 2019 10:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0KfdShr7WgDWnjYaYwE0xJHCtW0IWCnlB2CkbTBy3STSZVjRmoQbvwngd6LDf9NaaJZhd X-Received: by 2002:a17:902:bd91:: with SMTP id q17mr90595651pls.13.1558546930955; Wed, 22 May 2019 10:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558546930; cv=none; d=google.com; s=arc-20160816; b=TWC1XoR/g28sGl+zOHeRdwzKbESkM49VoA8qMVABO3tTbDmwX3Y1IslOx9CeKP4A76 ZWrYY9tecW3xqO747mL7g05jynYqPxsIjNc2ZU/E7niOFNw7WhavlDqT+tS/bZ6INSwb OI3RfWXWXos6WuszYNpkuGOCdhDY9sw1NmRLyTQMvv4n+x9KMuu7y5mLpGk5g6qTWjqX UKW0XVeGZ1kxjRpYK+j6l6DuYPXcD47yIQjdXnvF1pCw4TzRi805rbAhPFZNb8mrpbCq RMEcy3Q5uapEtW2O5WUEMdEdj+M6I4hn9BEYsPRqdrO4MU7fBn4vLU7yFjfhQnQJQzUP OhlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=r+LbwVtnREL8J4jW0/7rDfOqTAfm41yZBCnR4hEDOY4=; b=rTMc35uKqfQUlkTSayXz4N6XFLh/sQKwlLhar0XjSzybleTzPbL1BsWUSjFjeT8ILE we22OXUPFrq1aBgh7UYZmwhGiwD3z4cW0PyVCyGQ1RelX0aRgyZXosOGHiwhSZ3au5kg INyAGbNdGPh1BPS25iXsmDGhzSq4J8iyXwAT8pO5PpT7DxDvIk4HRHHzu+joRlQKRP5F 9gpq6uneEFzABxVb1LR9riKANGwBEwxNkgvoiiE4PMY9TO28i1vigyKoQCR/oVodAT/Q aRjtn3efHIoV+ObhfWbhSorHR+De9rX945ubEqkQz+Q3QfJ3TpxkwpgPXGLoKUp+pv6j Gb3g== ARC-Authentication-Results: i=1; mx.google.com; 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 w11si10088349plq.169.2019.05.22.10.41.55; Wed, 22 May 2019 10:42: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; 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 S1729515AbfEVRkV (ORCPT + 99 others); Wed, 22 May 2019 13:40:21 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:59166 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727499AbfEVRkV (ORCPT ); Wed, 22 May 2019 13:40:21 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::3d8]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 39F1515002414; Wed, 22 May 2019 10:40:20 -0700 (PDT) Date: Wed, 22 May 2019 10:40:19 -0700 (PDT) Message-Id: <20190522.104019.40493905027242516.davem@davemloft.net> To: rick.p.edgecombe@intel.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, linux-mm@kvack.org, mroos@linux.ee, mingo@redhat.com, namit@vmware.com, luto@kernel.org, bp@alien8.de, netdev@vger.kernel.org, dave.hansen@intel.com, sparclinux@vger.kernel.org Subject: Re: [PATCH v2] vmalloc: Fix issues with flush flag From: David Miller In-Reply-To: <339ef85d984f329aa66f29fa80781624e6e4aecc.camel@intel.com> References: <20190520.184336.743103388474716249.davem@davemloft.net> <339ef85d984f329aa66f29fa80781624e6e4aecc.camel@intel.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 22 May 2019 10:40:20 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Edgecombe, Rick P" Date: Tue, 21 May 2019 01:59:54 +0000 > On Mon, 2019-05-20 at 18:43 -0700, David Miller wrote: >> From: "Edgecombe, Rick P" >> Date: Tue, 21 May 2019 01:20:33 +0000 >> >> > Should it handle executing an unmapped page gracefully? Because >> > this >> > change is causing that to happen much earlier. If something was >> > relying >> > on a cached translation to execute something it could find the >> > mapping >> > disappear. >> >> Does this work by not mapping any kernel mappings at the beginning, >> and then filling in the BPF mappings in response to faults? > No, nothing too fancy. It just flushes the vm mapping immediatly in > vfree for execute (and RO) mappings. The only thing that happens around > allocation time is setting of a new flag to tell vmalloc to do the > flush. > > The problem before was that the pages would be freed before the execute > mapping was flushed. So then when the pages got recycled, random, > sometimes coming from userspace, data would be mapped as executable in > the kernel by the un-flushed tlb entries. If I am to understand things correctly, there was a case where 'end' could be smaller than 'start' when doing a range flush. That would definitely kill some of the sparc64 TLB flush routines.