From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x2273JriR6uWCig/7KQMFG+In8aHimv9rMqGRLa6NLjBG2DR5eZWYfLnDo2UQetNI1uGhtH9m ARC-Seal: i=1; a=rsa-sha256; t=1516964230; cv=none; d=google.com; s=arc-20160816; b=KNi4ur2+RnPVAHTmnVpzhf0WCOTkIKBXjDd7I1IL4X+nTVOvXqF/ke+Am1h0By1UQ9 y9VfBMhLns0OxlMNNFjxAvcSn3An0SXDw/GyeyWIKDdhjN8GkpTa2FhbWfF2Y7QVg2me yYSd9r4DFqvx3JT4c8h3yXT7qHgJLl7kegeZpehA8fCPgi6spx0jlTZ1WlJTBdukFYHo r1hLpAj6eT+KJFrNhIT6T1XZ3UzTn8oiY6LiPzQUz+Cypz9MSkSKjIspl1zAiKXNFKyC c5EOe2c5IZRgerahVNgyh0j1C31E6V6tH0rdxJvakad/8ZloidMGe3rUUprUbGnnnhZG PVjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=217Yi5e3LfmhHxpKNkJNZJmH0RPVVUpjfCtzkqX4Bb0=; b=DS+3Gla0ZmPbWZVQkJWyX3S6t5ljCbA0dAEtkZ8qeNFaLSwjB1rXEnfowPfizT3QF0 k5/PhvBNjFdEhBwqxFerjBInN++x9F/fiXWD8bA5PBTG4YdYlobcc+j915WMNXAOICr0 NUrlAV4v2vU/L82DOzw383fbyxmfUooRfGXjHHFbueKBH2Fbiwya/XLNRwt1rktCZ4Kr aIw3H5SEm2UUICuCzOp76ozurUGn3kXkbIymAKuzqgi8hLalM9B0ZwcYeq7w+FSLsMwz AmSIrh5BdT5ITVPMpEWAXjZs/QT6kgjhqLq9BA9c6nu1YN7BEcjbH0puEbueJo0fgsR0 qBXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of pbonzini@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=pbonzini@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Subject: Re: [PATCH 06/24] x86,kvm: Fix indirect calls in emulator To: Peter Zijlstra Cc: David Woodhouse , 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 , Jun Nakajima , Asit Mallick , Jason Baron References: <20180123152539.374360046@infradead.org> <20180123152638.336674335@infradead.org> <20180123202859.qc5frxyonavtkhpz@pd.tnic> <1516740493.13558.3.camel@infradead.org> <20180124103525.GR2228@hirez.programming.kicks-ass.net> <9fe90910-7908-f570-0088-568213f52a78@redhat.com> <20180125093453.GX2228@hirez.programming.kicks-ass.net> From: Paolo Bonzini Message-ID: Date: Fri, 26 Jan 2018 11:57:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180125093453.GX2228@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590397846081548237?= X-GMAIL-MSGID: =?utf-8?q?1590652284690322141?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On 25/01/2018 10:34, Peter Zijlstra wrote: > On Wed, Jan 24, 2018 at 11:43:05AM +0100, Paolo Bonzini wrote: >> On 24/01/2018 11:35, Peter Zijlstra wrote: >>> 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 ;-) >> >> In practice, "fastop" is going to be in a register because of how it's >> computed, but "rm" is okay. > > OK, so the other occurence in that file uses "+S", which is the SI > register. That cannot use THUNK_TARGET(), right? Nope, it reads the output in %esi too. > So do you want one THUNK_TARGET and one open coded, or keep the patch as > is (both open coded) ? Open coded is okay. Paolo