Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751784AbdG1CGJ (ORCPT ); Thu, 27 Jul 2017 22:06:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751758AbdG1CGI (ORCPT ); Thu, 27 Jul 2017 22:06:08 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFE6922BD1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org MIME-Version: 1.0 In-Reply-To: <20170727195357.GM277355@stormcage.americas.sgi.com> References: <70f3a61658aa7c1c89f4db6a4f81d8df9e396ade.1498022414.git.luto@kernel.org> <20170622145013.n3slk7ip6wpany5d@pd.tnic> <20170727195357.GM277355@stormcage.americas.sgi.com> From: Andy Lutomirski Date: Thu, 27 Jul 2017 19:05:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 06/11] x86/mm: Rework lazy TLB mode and TLB freshness tracking To: Andrew Banman Cc: Andy Lutomirski , Borislav Petkov , X86 ML , "linux-kernel@vger.kernel.org" , Linus Torvalds , Andrew Morton , Mel Gorman , "linux-mm@kvack.org" , Nadav Amit , Rik van Riel , Dave Hansen , Arjan van de Ven , Peter Zijlstra , Andrew Banman , Mike Travis , Dimitri Sivanich , Juergen Gross , Boris Ostrovsky Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2284 Lines: 54 > On Jul 27, 2017, at 3:53 PM, Andrew Banman wrote: > >> On Thu, Jun 22, 2017 at 10:47:29AM -0700, Andy Lutomirski wrote: >>> On Thu, Jun 22, 2017 at 7:50 AM, Borislav Petkov wrote: >>>> On Tue, Jun 20, 2017 at 10:22:12PM -0700, Andy Lutomirski wrote: >>>> Rewrite it entirely. When we enter lazy mode, we simply remove the >>>> cpu from mm_cpumask. This means that we need a way to figure out >>> >>> s/cpu/CPU/ >> >> Done. >> >>> >>>> whether we've missed a flush when we switch back out of lazy mode. >>>> I use the tlb_gen machinery to track whether a context is up to >>>> date. >>>> >>>> Note to reviewers: this patch, my itself, looks a bit odd. I'm >>>> using an array of length 1 containing (ctx_id, tlb_gen) rather than >>>> just storing tlb_gen, and making it at array isn't necessary yet. >>>> I'm doing this because the next few patches add PCID support, and, >>>> with PCID, we need ctx_id, and the array will end up with a length >>>> greater than 1. Making it an array now means that there will be >>>> less churn and therefore less stress on your eyeballs. >>>> >>>> NB: This is dubious but, AFAICT, still correct on Xen and UV. >>>> xen_exit_mmap() uses mm_cpumask() for nefarious purposes and this >>>> patch changes the way that mm_cpumask() works. This should be okay, >>>> since Xen *also* iterates all online CPUs to find all the CPUs it >>>> needs to twiddle. >>> >>> This whole text should be under the "---" line below if we don't want it >>> in the commit message. >> >> I figured that some future reader of this patch might actually want to >> see this text, though. >> >>> >>>> >>>> The UV tlbflush code is rather dated and should be changed. >> >> And I'd definitely like the UV maintainers to notice this part, now or >> in the future :) I don't want to personally touch the UV code with a >> ten-foot pole, but it really should be updated by someone who has a >> chance of getting it right and being able to test it. > > Noticed! We're aware of these changes and we're planning on updating this > code in the future. Presently the BAU tlb shootdown feature is working well > on our recent hardware. :) I would suggest reworking it to hook the SMP function call infrastructure instead of the TLB shootdown code.