Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1566859ybx; Thu, 7 Nov 2019 13:46:09 -0800 (PST) X-Google-Smtp-Source: APXvYqz7QtIkTZ9Xb9HxjiVLInU4ziAtbLmHlQiEAtQedCgLF3jXuUOqqxurZQJUuHFusSOSdYIa X-Received: by 2002:a50:ff12:: with SMTP id a18mr6240501edu.200.1573163169691; Thu, 07 Nov 2019 13:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573163169; cv=none; d=google.com; s=arc-20160816; b=bW0YiB9l770PlUKzsrDr+k5Rtbmy2NZOO0KdmZbMpAoemBY/zHcE5xLer+/GQMEaqn wp6AENcvWoQ4sorlqVuUn7AspqMtWD0KgvopEKfzl6xb4NLcp1P0rJ4ibdFc+l/vXnBG 6UfFubXpJwTl9juPOeSO79+lZY/I9ZN7mgYfSTSwGzz/CiJ3fkk9+3JTxfXZ9Mt/eGP/ I2S27oQrtJ56hBEb1SkcxHAW/Pj1iuph8DERYCimv70BXmTfvNaXubNVXSwO1qKJZNcM zI50S0UZ7l2zFjTxwFGemn8qWMY+c69K9s0RGCtV+uqwtA/9NHA/QGJKakShgSL1NLce CezA== 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=D7bkoIfmChxAzW1ksec2xFter3BulfhV3l8t8jMt0o8=; b=DJlVkG/PJPTDxzY9Nh1Lt1GfoZcQpOB5NSkl/pbDD08xQccG/95+yrS11bL7Jk6a0X MJcu5Sbq8QrrDWxZZ4NOCV5cPnvJx2bDyrFiH51rVexFE93nVkrdTHsA5XHK8ntODg7+ gyCZCtlTHDNIe387lwXv6i/CU8qiTL1G0Mj1yyRgkzwld90gZNl6PJcQeAN4T2oUvqnO eaZd0p+y0hq+9iDfDuLUeSAHpEs8w8Xd8pvmYCUlsuWDj5kVsgj3GnzWulpOauT7kzPX h4n8PjyH2mzkwkFq8xrmP4bjppAYN1BUBbZyYLmvp9MDdcelqPipxme0EEOvbbJRZvYh MvUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=J4Q5rwkR; 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 k39si2632600edb.99.2019.11.07.13.45.46; Thu, 07 Nov 2019 13:46:09 -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=pass header.i=@linux-foundation.org header.s=google header.b=J4Q5rwkR; 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 S1726281AbfKGVpI (ORCPT + 99 others); Thu, 7 Nov 2019 16:45:08 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:43459 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbfKGVpI (ORCPT ); Thu, 7 Nov 2019 16:45:08 -0500 Received: by mail-lj1-f194.google.com with SMTP id y23so3929541ljh.10 for ; Thu, 07 Nov 2019 13:45:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D7bkoIfmChxAzW1ksec2xFter3BulfhV3l8t8jMt0o8=; b=J4Q5rwkR0WSSlDmDqYN9Kqe/AJ3WCJnx1cqvE9HtXpewbCpG5f9IJFYCHTKIpv34kx DHm07h87q/aD2rSKrES3gUnpaKOGs88rHCOpdXLXBY21/nAT8sTC8cmHC/t5Tx40Ct2G GlijRx9m/QGJMeUhMbd8aquNuU/aqEXSTspdM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D7bkoIfmChxAzW1ksec2xFter3BulfhV3l8t8jMt0o8=; b=NCBA223wIDefnqG2vbAH/c/1EpIXwo5VphVwXtYBhd/0P249e2vDHy+lhDCZsyBdvg +7eeaaH5JjCcfJQUb7IuNNIQB/pHs8SLmt9qyrDRjqZrNLRE1/qxsAQxHiOpJl4iESkj qGVtXetbFWTgZRpeVXklJbAbwhU4+hXyJCPJCp9QOzZDq/a9aXHIhjjyA1f1z5Isumoe Wzztrfl/YGcZvm2nlTDebAZqZL11sCqy9IbKnUXwjW0MiO9ak4puZZeA3arBTpuCC1Pp /E3daxnnMdD8X21FKwEhxNp6MHEEvR+MtcnB1rGKWD13MRUcuZReaTCMRLu8L2ZeCy+8 WRLA== X-Gm-Message-State: APjAAAWgtEI03cV0NbALOoGQC423O2csC5ZbG4pSUx6rA5JFvLfY60R2 ywORxQ6DAbkoq/HsJG1DAF6X7nFSmWg= X-Received: by 2002:a2e:89c4:: with SMTP id c4mr4108599ljk.197.1573163105106; Thu, 07 Nov 2019 13:45:05 -0800 (PST) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id g25sm1724191ljk.36.2019.11.07.13.45.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Nov 2019 13:45:03 -0800 (PST) Received: by mail-lj1-f177.google.com with SMTP id l20so3953069lje.4 for ; Thu, 07 Nov 2019 13:45:03 -0800 (PST) X-Received: by 2002:a2e:22c1:: with SMTP id i184mr4191987lji.1.1573163103162; Thu, 07 Nov 2019 13:45:03 -0800 (PST) MIME-Version: 1.0 References: <20191106193459.581614484@linutronix.de> <20191106202806.241007755@linutronix.de> In-Reply-To: From: Linus Torvalds Date: Thu, 7 Nov 2019 13:44:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 5/9] x86/ioport: Reduce ioperm impact for sane usage further To: Brian Gerst Cc: Thomas Gleixner , LKML , "the arch/x86 maintainers" , Stephen Hemminger , Willy Tarreau , Juergen Gross , Sean Christopherson , "H. Peter Anvin" 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, Nov 7, 2019 at 1:00 PM Brian Gerst wrote: > > There wouldn't have to be a flush on every task switch. No. But we'd have to flush on any switch that currently does that memcpy. And my point is that a tlb flush (even the single-page case) is likely more expensive than the memcpy. > Going a step further, we could track which task is mapped to the > current cpu like proposed above, and only flush when a different task > needs the IO bitmap, or when the bitmap is being freed on task exit. Well, that's exactly my "track the last task" optimization for copying the thing. IOW, it's the same optimization as avoiding the memcpy. Which I think is likely very effective, but also makes it fairly pointless to then try to be clever.. So the basic issue remains that playing VM games has almost universally been slower and more complex than simply not playing VM games. TLB flushes - even invlpg - tends to be pretty slow. Of course, we probably end up invalidating the TLB's anyway, so maybe in this case we don't care. The ioperm bitmap is _technically_ per-thread, though, so it should be flushed even if the VM isn't flushed... Linus