From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934423AbdDGTm0 (ORCPT ); Fri, 7 Apr 2017 15:42:26 -0400 Received: from mail-sn1nam02on0120.outbound.protection.outlook.com ([104.47.36.120]:55568 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756049AbdDGTmS (ORCPT ); Fri, 7 Apr 2017 15:42:18 -0400 From: Jork Loeser To: Vitaly Kuznetsov , "devel@linuxdriverproject.org" , "x86@kernel.org" CC: "linux-kernel@vger.kernel.org" , "KY Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Steven Rostedt Subject: RE: [PATCH 2/7] x86/hyper-v: fast hypercall implementation Thread-Topic: [PATCH 2/7] x86/hyper-v: fast hypercall implementation Thread-Index: AQHSr5HoZRPhelnvPUu9nkW1D8tTuqG6Tdlg Date: Fri, 7 Apr 2017 19:42:10 +0000 Message-ID: References: <20170407112701.17157-1-vkuznets@redhat.com> <20170407112701.17157-3-vkuznets@redhat.com> In-Reply-To: <20170407112701.17157-3-vkuznets@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:4::1f] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR21MB0639;7:un+HovJ8KsdvNFOM2UyZcU30qWQbZbG344R5qWeVjTx5mdJnhq+FAqnRIapnH/o0s17iX9FjQlw4BoAmOdfUY5vk12o8PT7YNSTuZKGtBiybYLSzJOrsiVkLFBgb8blKZJ0ac7YXTPbCiKnO7Ad1ZOmSuMftGqyr/yrEQxE0eiGIOMof3aRqgjpwuA8FEfb7bDxob0fPbL0G7fE3UZQcftOyVLtsnMrXOk2GL2tiJQmIIC7WYJTQXx0Ie9jd6smPGqqPOtF/yFMd4XEr0a9m0+gbZzvj8fAbVzOHgiSiuI0b0cj1ezNb2p+IO8KD7zGhb7C/WCMUJNGdfuU0f8d7ziXnqLwid2FacB14fFRR+cI= x-ms-office365-filtering-correlation-id: 708a1a07-1f71-4f9c-df88-08d47dee2ebf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:MWHPR21MB0639; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:MWHPR21MB0639;BCL:0;PCL:0;RULEID:;SRVR:MWHPR21MB0639; x-forefront-prvs: 0270ED2845 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39400400002)(39850400002)(39450400003)(39860400002)(39410400002)(39840400002)(13464003)(99286003)(54906002)(55016002)(8936002)(9686003)(33656002)(53936002)(189998001)(81166006)(74316002)(7736002)(305945005)(2201001)(6116002)(102836003)(86362001)(86612001)(2906002)(54356999)(76176999)(2501003)(50986999)(6436002)(8676002)(7696004)(4326008)(2950100002)(10090500001)(10290500002)(5005710100001)(38730400002)(6506006)(6246003)(122556002)(5660300001)(77096006)(25786009)(3660700001)(53546009)(3280700002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR21MB0639;H:MWHPR21MB0639.namprd21.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2017 19:42:10.5266 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0639 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v37JgYVP015751 > -----Original Message----- > From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] > Sent: Friday, April 7, 2017 04:27 > To: devel@linuxdriverproject.org; x86@kernel.org > Cc: linux-kernel@vger.kernel.org; KY Srinivasan ; > Haiyang Zhang ; Stephen Hemminger > ; Thomas Gleixner ; Ingo > Molnar ; H. Peter Anvin ; Steven > Rostedt ; Jork Loeser > Subject: [PATCH 2/7] x86/hyper-v: fast hypercall implementation > diff --git a/arch/x86/include/asm/mshyperv.h > b/arch/x86/include/asm/mshyperv.h index 331e834..9a5f58b 100644 > --- a/arch/x86/include/asm/mshyperv.h > +++ b/arch/x86/include/asm/mshyperv.h > @@ -216,6 +216,43 @@ static inline u64 hv_do_hypercall(u64 control, void > *input, void *output) #endif /* !x86_64 */ } > > +/* Fast hypercall with 8 bytes of input and no output */ static inline > +u64 hv_do_fast_hypercall8(u16 code, u64 input1) { > + union hv_hypercall_input control = {0}; > + > + control.code = code; > + control.fast = 1; > +#ifdef CONFIG_X86_64 > + { > + u64 hv_status; > + > + __asm__ __volatile__("call *%3" > + : "=a" (hv_status) > + : "c" (control.as_uint64), "d" (input1), > + "m" (hv_hypercall_pg) > + : "cc", "r8", "%r9", "%r10", "%r11"); > + return hv_status; Clobber memory (are there such fast hypercalls)? > + } > +#else > + { > + u32 hv_status_hi, hv_status_lo; > + > + __asm__ __volatile__ ("call *%6" > + : "=d"(hv_status_hi), > + "=a"(hv_status_lo) : > + "d" (control.as_uint32_hi), > + "a" (control.as_uint32_lo), > + "c" ((u32)input1), > + "b" ((u32)(input1 >> 32)), > + "m" (hv_hypercall_pg) > + : "cc"); > + > + return hv_status_lo | ((u64)hv_status_hi << 32); > + } > +#endif Please clobber ECX, EDI and ESI for x86. Clobber memory as well?