Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1015992ybx; Thu, 7 Nov 2019 06:06:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwBvnaHFOoC50jHOHQER8wQTIlHmn940ZZvGgHoIlV0fb+AYpuVorkDXdT7UMTycj3M3Dop X-Received: by 2002:a17:906:73d4:: with SMTP id n20mr3210572ejl.45.1573135568801; Thu, 07 Nov 2019 06:06:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573135568; cv=none; d=google.com; s=arc-20160816; b=bZSwPrscGygZ4YRXbpIiSop6aKczmeFPqLIQ3NSX+BgTbAK98T8uojbvR3WyJm7L3f aY3jEBt69XEzrV47rt8w1KbxBm5wMRuo2rnyjsgSwcCJLAnW2QdWAPD9+yX+rIFc+lOn 7i3L0kYTNy7NpSIY1P8GHs3WUxydSuwzHd7bMvEnInaiLDPAqRLD00Bqx74pW6+P7Jn/ 46L8UFq43SZfGYPi06yYpYqVaz7bR9fLBGSdhDoqQK1WJhcEURGeVBeLdcFZXlcSV8iH YTMkny/z+GM+v7Urg9RtwaFmAnppHnYeWef9auRa99ykAblCoApeJ1+4LtMOfZSuqCBI 0GsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=UxqS/LqWQv7obrPu+bfEDaypxNyQkdW2cneilqggyc0=; b=VrpaEc8uIHz8Ii4qdTjzTXv+QJ8iK9zF7Ehn5Pjlf2rHoaYr/mCwiw+rryfcxq0KtA WxgC+BT+vfRvkOAfnCQtgAH+zl6tjAZj/5AvZIfQ9HOJZj8tgSpluMh7ZdKu7ltCgVAS G1oFPAaq0emR/js9B+gfyzLV9/+SqRDpcQ9J9AbjRo9ZBhcPxmU3Pw72higv96ub1+jh +IIdf3rywcGC3eHFKCGlXNFJu0u2hvSgirRbhjT6jba/BfqcrX5jQxyJTTAiK40J57t6 tCiqjvIisJuQ/KiCtYR87Gnpau4tHUc+gMB42eSSEeuVcp1CjC3WEuKpNAvXeoNXVp4c waXQ== 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 y31si1501143edb.47.2019.11.07.06.05.43; Thu, 07 Nov 2019 06:06:08 -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; 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 S2388456AbfKGOEP (ORCPT + 99 others); Thu, 7 Nov 2019 09:04:15 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:47925 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727858AbfKGOEP (ORCPT ); Thu, 7 Nov 2019 09:04:15 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iSiOP-0007Fh-7S; Thu, 07 Nov 2019 15:04:09 +0100 Date: Thu, 7 Nov 2019 15:04:08 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra cc: LKML , x86@kernel.org, Stephen Hemminger , Willy Tarreau , Juergen Gross , Sean Christopherson , Linus Torvalds , "H. Peter Anvin" Subject: Re: [patch 4/9] x86/io: Speedup schedule out of I/O bitmap user In-Reply-To: <20191107091231.GA4131@hirez.programming.kicks-ass.net> Message-ID: References: <20191106193459.581614484@linutronix.de> <20191106202806.133597409@linutronix.de> <20191107091231.GA4131@hirez.programming.kicks-ass.net> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Nov 2019, Peter Zijlstra wrote: > On Wed, Nov 06, 2019 at 08:35:03PM +0100, Thomas Gleixner wrote: > > There is no requirement to update the TSS I/O bitmap when a thread using it is > > scheduled out and the incoming thread does not use it. > > > > For the permission check based on the TSS I/O bitmap the CPU calculates the memory > > location of the I/O bitmap by the address of the TSS and the io_bitmap_base member > > of the tss_struct. The easiest way to invalidate the I/O bitmap is to switch the > > offset to an address outside of the TSS limit. > > > > If an I/O instruction is issued from user space the TSS limit causes #GP to be > > raised in the same was as valid I/O bitmap with all bits set to 1 would do. > > > > This removes the extra work when an I/O bitmap using task is scheduled out > > and puts the burden on the rare I/O bitmap users when they are scheduled > > in. > > This also nicely aligns with that the context switch time is accounted > to the next task. So by doing the expensive part on switch-in gets it > all accounted to the task that caused it. Just that I can't add the storage to tss_struct due to the VMX insanity of setting TSS limit hard to 0x67 on vmexit instead of restoring the host value. Did I say that already that virt creates more problems than it solves? Thanks, tglx