Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp699940ybx; Thu, 7 Nov 2019 01:14:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwJZndQnPB4ZwdNn4srpzn0UyCir5bxzEYXeWZPRcDaGgCBUKpoS7jAxgcz6SawhtrpXNNi X-Received: by 2002:a17:906:3019:: with SMTP id 25mr1988116ejz.280.1573118065057; Thu, 07 Nov 2019 01:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573118065; cv=none; d=google.com; s=arc-20160816; b=AD4ZeXGue2mcKeAun+aAwqRpPY0JkdF2CaqsY+etxzeTZrSyDkh5zkNYm/sYu/HNUQ hOdjSpnXbxyIGpNeamgMmaz4WGr5RXuVHk2vhSQy14NHTEcevCy3Pziia1lkyvRsZ3o0 8JfvG88lR+8Qi+5SrNvomzIM/96V/Ygml8xUOZSotcESbyv8Bq8vDDLOELy0L2FxzPtU MOe5nXklEzsygAm/N5HiFNCyIR7R0hHo3LkRKLbXyat6Er3p9GcSGq1xEPVuevc+Ui0W Fsg1RcOQ7AJEeyAgusaG1G843PS9JcsElNBwFCoBh24u9xBUk49DvNurpDos2ao14m9/ xJEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=stpQ2ZxVbR6vwFgf2kbMBwfdaXFgcnuA4lpQdxAozKo=; b=sEcHnByGjZzd4BJOZ5LJ4F3++zug2kj36l1treX/1xmQVXZvjbQ8CWuXgqIxTyvkZr egqbNkGV2rBWe++vTb/JW8B5f6ypH2wTAR830rACv3nR67j4UDLBGWim3V7qAwkDeU5f whJmqZBzT80BUarAWG1GnWkks8rrL7wDWQkArH4i2OevDdaLgDhEOZKTr5JkKD9s1Jq2 ZyQtB8FPRoGuKGQXhGUnk4W0jI4W0kIQ38MZhl8m/V/egM6E41NCe6mQEEBxTSs7glkj jS87P4wyRz9Ww2iEQPar/bhGkINUtAo1g5fOau20dqF1KwPe2xuODOIKLTwifwM6i8Fk SqVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jnbLISrU; 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 z16si36973edx.337.2019.11.07.01.14.02; Thu, 07 Nov 2019 01:14:25 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=jnbLISrU; 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 S2387436AbfKGJNH (ORCPT + 99 others); Thu, 7 Nov 2019 04:13:07 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58662 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727120AbfKGJNH (ORCPT ); Thu, 7 Nov 2019 04:13:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=stpQ2ZxVbR6vwFgf2kbMBwfdaXFgcnuA4lpQdxAozKo=; b=jnbLISrUxo7DzyoIX7Dwgcg8y bC3qwfzYzuye2C2c6PMptTeYRd37Cl7MMcQwjhBnmwbAoB8QmFMjtWZrsx0cZ56o5VBh/NIdwLkgE sIN+e025d509E07PGAEnTAPSCsYJVvQX3UnB0qohMqWKg0qT/tz9QSzRv6/a51yyWtBgDAxAIryGt +u+7tZpXt8B+x8ZmlCq+/gQg+DJoeA3aa6tsjsyHQUuYeWptQeePwdCNJjQetywE6/Pt+bJmGO10r A0h0nttFg5vbtzuXo2I72B8e3mYoumeScnymEIp/LdKPcZaXI46WDVs4ZEzQdJKNomqCh02NNKzsd nsTTLyAOw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSdqF-0002Xp-Ry; Thu, 07 Nov 2019 09:12:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 61933300692; Thu, 7 Nov 2019 10:11:27 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BAC432B13B364; Thu, 7 Nov 2019 10:12:31 +0100 (CET) Date: Thu, 7 Nov 2019 10:12:31 +0100 From: Peter Zijlstra To: Thomas Gleixner 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 Message-ID: <20191107091231.GA4131@hirez.programming.kicks-ass.net> References: <20191106193459.581614484@linutronix.de> <20191106202806.133597409@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191106202806.133597409@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.