Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1021061ybx; Thu, 7 Nov 2019 06:10:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxB/RFJnDh67sUhiuUTTNO74FeGOjWnLYW842DsZDjT8vtGZtvk6SFYXaMS5j/rU0FY8hQl X-Received: by 2002:a17:906:2599:: with SMTP id m25mr3063443ejb.227.1573135818890; Thu, 07 Nov 2019 06:10:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573135818; cv=none; d=google.com; s=arc-20160816; b=JE0D0Ffaf/5l32TIRT90C2iR0clkqlGBJVwVV0u4/NZygf31nKtIl2oQPgBOqo/0GY R292O5KSDdolcvEooLHW+wtayXam4hxyRupBsh2nSPCeGOzvFZnevsNu1ffJ8xFBxGX1 V2nrybyiW4A75zw+g1v4L7QEnnRHO1lg2PzqMd0PBBtMI+yS6J5h8DmlltKbAB3Aszbt oCe2mTslVtMX10Uhy/2cHtSGRcBY66+g6cEwqoOblEFmecpK5GRXIgCQPKUeoHi65hY8 d5m7ags/YjczL1GzpbEElbWp5Mk3NMcVdSoQWvXxwMNvauyHiRAf0Pj6XTvXl34vl22Z +obg== 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=slfOtJmAMDc6LA9VROugrB8h+t0mM2Q5g/RJXbNTz4Y=; b=GkAyG3qf81eJksKwqFT6STHqma2ZhGt+R6yKvENFxQg/XJ5lebU5JzHBLTPJ3cDQ47 /Z+JR4Xgg6AqHN00cB84NxqXkSQJHcidWLR/S1uwdxgCj383Bl1aI76IY7ZToJ8K1uTT N+01FNd+f1TlXOvwV9ExuWGsSFY1oQ7aWBdjziiVM/nJHxctwxO39u/sy9jO2BrIPZoN gUTlAJaHikOSxFvSa+l5sPRUg9zxZTLvsQ5kLyktXsEqdBQs68MEHm+dlwlvUQ0Q2TLw 4Agg256NMSWDqyAGiUQqPAgib0txNfZ7UargDOoPjIhKaWNBm/gSorQl3n6GXvCQ3AZZ XaJQ== 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 24si1706967eje.293.2019.11.07.06.09.49; Thu, 07 Nov 2019 06:10:18 -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 S2388008AbfKGOIt (ORCPT + 99 others); Thu, 7 Nov 2019 09:08:49 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:47941 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbfKGOIs (ORCPT ); Thu, 7 Nov 2019 09:08:48 -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 1iSiSr-0007K7-Ce; Thu, 07 Nov 2019 15:08:45 +0100 Date: Thu, 7 Nov 2019 15:08:44 +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: 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, Thomas Gleixner wrote: > 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. Well, I can. The build bugon in vmx.c is just bogus. > Did I say that already that virt creates more problems than it solves? Still stands. tglx