Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1444912pxj; Sat, 15 May 2021 15:21:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0y2cT1QjnVdotfqxZW8NrlC0QQs1SxCv1kes9NiiLSGDAJrUdmvhsD5AJMsdls2gRvP0q X-Received: by 2002:a05:6e02:104b:: with SMTP id p11mr8566736ilj.275.1621117284056; Sat, 15 May 2021 15:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621117284; cv=none; d=google.com; s=arc-20160816; b=qruMYP3xLTVD0xKvQxCXosZR5Gvz+8sQ1Z3/7dwd5BWHRYCwV0bir9r5saMuMxxgk2 pa60EmfRoVjhxMT1+PglsKja41STmKfnUxn/9dUsY0kkn5eGGnJeTARz4zOG5MGbwdHZ XCIBRsMxWoG8DqKjmMvghdR6kF3TTqi80Rmhkrb0OlwW9s1TedvvF1+gpOEGp4kBN5jZ kx1ZJAOz9tlelCgrw4jvNs7K2fZTx0Vk9MyZ0XZoO76JKmJUJbfrGl0qd5+9GpDbPF7e a9xG4ekphmfw0BPWsrjctYMvo9Iuod1rXvP9IseMHbQVoDUpG9/PmA40XcETt1Ac9ni4 o2+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Anu/986O+EMdkcxHYSZ/Sxi00sCc0YWECVtWtxygmfE=; b=lp9wIxc/3sRIVESAhpz3uAtKRc/AnPf6KnFEVt5PuCsgAciuyTUf/sdkhlSLYZ5S+d JExwyF2WB4hVbZ+15YjaqCv979/5mO9gBn8DE3Y/3hNOnWwzYUJm2m0iYtEGI774HnZE KpDvvhEPVRindC6fucLJQYV3LM7zo4/91Q9P8Nzsn7M41aNmYrm6q0ooGE85zGDeiarl IRmcp126Z8aftICp32sofTEOoRNt5SNscn3KgPfY7eNnw4XHOmLfoghL53Miad5wqrDD PUF+9mMsE6td630Rw1YgM/bOal5tFFvWIPLb7h2jj4VMMYbB7ZiUWmWB6ul8FMHZFtT2 hi5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FtfrvzJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si11821425ilo.146.2021.05.15.15.21.11; Sat, 15 May 2021 15:21:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FtfrvzJu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbhEOPa4 (ORCPT + 99 others); Sat, 15 May 2021 11:30:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:32958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232483AbhEOPax (ORCPT ); Sat, 15 May 2021 11:30:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD4B3613CD; Sat, 15 May 2021 15:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621092579; bh=BcG8mCe9C/Ts+MPHGTEIAQ8DSW/EoqxmARLmaOLsK5Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=FtfrvzJuPJiQjaidajh1nzrxEQaELUYoCvIZchLuBnLjpxNYBs++9hhrEpg9w7Zbz Uqvkcmh6MtcrWMKlQUC3DxWdwvjmz2YtFe5RAiv6JAZvg9LUYPb9D6XbjFcir00Akg UJW/J10lEFE350NSOZkuh38BVT8byEmZ4nBaYovp6H59RTq9JQSIb922yK4FEpuUiy c1Pf+bXkQH/y/h8UXBkauOqT8Qm3I25vu+5Gf+fWGAoYJ6nxenw5ZiK6YQ5QAUB38D AOUcEa9o/GJd+sTavlxDxNLh2rkrNfV0djxoZW7BjbRBc+e/c1ey461VkDQ0X0uJzJ 5u74Y1ZCRBbsQ== Subject: Re: [PATCH v2 5/9] x86/desc: add native_[ig]dt_invalidate() to To: "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Linux Kernel Mailing List References: <20210515014400.2999028-1-hpa@zytor.com> <20210515014400.2999028-6-hpa@zytor.com> From: Andy Lutomirski Message-ID: Date: Sat, 15 May 2021 08:29:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210515014400.2999028-6-hpa@zytor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/14/21 6:43 PM, H. Peter Anvin wrote: > From: "H. Peter Anvin (Intel)" > > In some places, we want the native forms of descriptor table > invalidation. Rather than open-coding them, add explicitly native > functions to invalidate the GDT and IDT. > > Signed-off-by: H. Peter Anvin (Intel) > --- > arch/x86/include/asm/desc.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h > index b8429ae50b71..aa366b2bbc41 100644 > --- a/arch/x86/include/asm/desc.h > +++ b/arch/x86/include/asm/desc.h > @@ -224,6 +224,21 @@ static inline void store_idt(struct desc_ptr *dtr) > asm volatile("sidt %0":"=m" (*dtr)); > } > > +static const struct desc_ptr __invalid_gdt_idt_ptr __maybe_unused = { > + .address = 0, > + .size = 0 > +}; I'm not convinced that putting this in a header is really a great idea. How about: > + > +static inline void native_gdt_invalidate(void) > +{ const struct desc_ptr ... = ...; > + native_load_gdt(&__invalid_gdt_idt_ptr); > +} That should generate two PUSH instructions and may well result in a smaller binary :) --Andy