From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226t7RApTSwT5K1x9E1j3UC5cQUuaQXaMmRE6TfKvNUStgSlXk3XbeOcD+09gw493d2YE5F2 ARC-Seal: i=1; a=rsa-sha256; t=1516790135; cv=none; d=google.com; s=arc-20160816; b=jiJT9FvlDpQed0CQSrKrmBGJbo6ifsIiUnkZevwLqS43RmqjxeKlgXb+BvdK6ya4dh 0+zYUaVFrWKtFLP5KZ9s17JtvwBXckkouOWP9np+e08E37FRyCSDq9VmpLdKV9TC45Fg VF6K0wdAMGHcWX3qXW2E7myvKyeRXz6hmKAfub1V0VNYR3pmpj2yvh0H4Mdwwyd6pydh 3pyoYjVCUGLFivQzsADfhOr5bOfByI5MhoFjYL9sj0znKw4PoebPu7Af6Cb4INPw/aRS cm8aJhrO6aTd/dCVZYTNs1K9HtzhPJPMEo1UrOnyMja5iniWuPRZYt0uSdrSLWTWOBaE Undw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=D5SzkKVadEbcMhra1z8tm4S79la6F94cT23PrdhKhtg=; b=OVKoG++5CINyA30PzIswgr8Dalo7TBM9Vu0+XLHej7+REKjVBz2buQ22RG+w03a2rY ZYbj7G8WfZ1tybZtPHCoXsBMYZulEgqEoUMiW2vCCLWlsw1r0AnEbdUOQ8uWkx+DwaTv Jr1l+VKbnzj4SdvrsyU0WLidJXhPsJYPyBS+8eG60XS4x/O0RKtsa0Cw13qO4A8xjxTN /58wTL2LuiBaviSMmNu8Ukv1T/CHJSWB6cXGuvJYk5cM307t6UlTYmIjRswmpwXK9QF+ XzftICeWPLag2ezQcBtTRCgEAlWqzN+VPKhHgMO6uZuwOd1ewavRPosmT/t/gcL+qIzY YLsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=WrxQDTVE; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=peterz@infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=WrxQDTVE; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=peterz@infradead.org Date: Wed, 24 Jan 2018 11:35:25 +0100 From: Peter Zijlstra To: David Woodhouse Cc: Borislav Petkov , Thomas Gleixner , Josh Poimboeuf , linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick , Jason Baron Subject: Re: [PATCH 06/24] x86,kvm: Fix indirect calls in emulator Message-ID: <20180124103525.GR2228@hirez.programming.kicks-ass.net> References: <20180123152539.374360046@infradead.org> <20180123152638.336674335@infradead.org> <20180123202859.qc5frxyonavtkhpz@pd.tnic> <1516740493.13558.3.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1516740493.13558.3.camel@infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590397846081548237?= X-GMAIL-MSGID: =?utf-8?q?1590469733367930309?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Tue, Jan 23, 2018 at 08:48:13PM +0000, David Woodhouse wrote: > On Tue, 2018-01-23 at 21:28 +0100, Borislav Petkov wrote: > > > > >       flags = (flags & EFLAGS_MASK) | X86_EFLAGS_IF; > > > -     asm("push %[flags]; popf; call *%[fastop]" > > > -         : "=a"(rc) : [fastop]"r"(fop), [flags]"r"(flags)); > > > +     asm("push %[flags]; popf; " CALL_NOSPEC > > > +         : "=a"(rc) : [thunk_target]"r"(fop), [flags]"r"(flags)); > > > > Oh, "thunk_target" is magical. > > You can use THUNK_TARGET(fop), which will be "rm" on 32-bit and avoids > register starvation in some cases (I don't think the hyperv calls > worked until I did that). The reason I didn't use THUNK_TARGET() was exactly because it used "rm" and the current code did "r" only. I'm happy to change if people can agree on something ;-)