Received: by 10.223.185.116 with SMTP id b49csp7528616wrg; Thu, 1 Mar 2018 07:01:00 -0800 (PST) X-Google-Smtp-Source: AG47ELsgbnrEt0Jf/18BFQrewi/uRHvTsX+euWnaB1JxHJ1We1/zZ1p+hvVmkqLCXKZlEKzUWfj2 X-Received: by 10.99.60.72 with SMTP id i8mr401574pgn.399.1519916460413; Thu, 01 Mar 2018 07:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519916460; cv=none; d=google.com; s=arc-20160816; b=Uk/A3p0z3Xf8QqC21XMIO8QsFSPglVo7CJi0gSxpFACK4Fge0QVKxbG3NaMbYLmFiL xa1cTPg/g78kzyy7JqSDFqk0BwK2vuWk10s8um3Q6KeD8QjXENWBQ3oF7tz3W4may62b laH3dNRwT4vQ0fP0djOhkXihm3fdzKbbcr3/mYfspH/boHlfesIK/5vqrwNtcQuHv5xU 6O7ElI16JLdSP8bLhOmNoXuUziDsuefMMKDnJJ1YYfpFCrmgK4sYB8mm6JA4WjbLrYNC bM55TGTZunow4o0/LkijU6zhzK5I7V5ehrht5jBnYO3uaXvZ5wxFoiKAgryge9D/0oV+ wUxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticoutput:user-agent :in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=gT5bwCEKPYhO4hXXUKajt12iImXrl5mzs0Zie1YIoBI=; b=S0xV/DNP8+frZvLaPQ0w6vH22bze7CQhRl1LVb126QmP2lTSfXoeMoZBjFukuJNXak 8NZe1lfKWSY0lyHcKNT3ztIMmoXPdMaygd+Zfe+bd6aywWsdvrKPgvCnDKBngIWCnm7s CQYoKwJtd28efv647raTyMdfvTbJh8GImC/GreP9qtDWRUBqWguR22fKzXfz9nhKNu/Z q9eEC5VpRlAy1Wfs2xipeKcidYhGNks+fgh6a/N/MxYjHfdcZg1STE4A+WbRD7kEYfXQ okb7J87xnIRGh8mPy2Emw6gmtwyng8xYDzWnkW1rNHl2tYO/7sFfOHTgp2cFmhWfEzHB RTbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=KNbqqh1Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o27si3127043pfi.119.2018.03.01.07.00.33; Thu, 01 Mar 2018 07:01:00 -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=pass header.i=@virtuozzo.com header.s=selector1 header.b=KNbqqh1Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031613AbeCAO7z (ORCPT + 99 others); Thu, 1 Mar 2018 09:59:55 -0500 Received: from mail-ve1eur01hn0206.outbound.protection.outlook.com ([104.47.1.206]:4306 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031551AbeCAO7x (ORCPT ); Thu, 1 Mar 2018 09:59:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gT5bwCEKPYhO4hXXUKajt12iImXrl5mzs0Zie1YIoBI=; b=KNbqqh1Q6uv9TFTIaqOy9skfDVwfm4cTriEW/Ua4tZN46X33rOFpAf00w7OwytPJq5Q61iZ8ASdE/rOGMyI27PHaG0xq4roZKWmO7HoUlBIU0RwJZ4gOAq6t3oFhYYakcpRY9TqjZcpMY6dM8cvrSZA274hHrmcRw5fOyJ4lGB4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR0801MB1981.eurprd08.prod.outlook.com (2603:10a6:800:8a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Thu, 1 Mar 2018 14:59:40 +0000 Date: Thu, 1 Mar 2018 17:59:35 +0300 From: Roman Kagan To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , "Michael Kelley (EOSG)" , "Denis V . Lunev" Subject: Re: [PATCH v2 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked Message-ID: <20180301145934.GA13964@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Vitaly Kuznetsov , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , "Michael Kelley (EOSG)" , "Denis V . Lunev" References: <20180301141514.3482-1-vkuznets@redhat.com> <20180301141514.3482-4-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180301141514.3482-4-vkuznets@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0202CA0019.eurprd02.prod.outlook.com (2603:10a6:3:8c::29) To VI1PR0801MB1981.eurprd08.prod.outlook.com (2603:10a6:800:8a::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11c158cb-f70b-40c9-c5e7-08d57f850f85 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:VI1PR0801MB1981; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1981;3:E30rb0evo9BZYSfK1OdjROq0CK265Vlk7wtB7Nl3rkyhAFUbEX/uaJ+K+fnkEM2WSUe+M1Cm+nG/K+nFfWrDUzk4lIgVni50yyqQNcns057kqIebfs/VWid0Fa2hCjSRV9BScVqOx/ZwbLr75OHW8obHEAz1Qfr/sRVjxcGXPoYiUQP8HjW+PvCqCDwSjUg/o97TkX84+hBp3yLczlICuEFfTiKyS+QODSqdYFUNPBjzLAHp9LynbZgFxA3unvx7;25:9tlk8wbAZhKDlxtakrsFnPlz+AFWeMIAYWkG79KDQ3C6tGchMHIc5L+3ZPHJvjqtsNv9hkmVPRbjN7AH5M2NWGxXuR5MHtEIHB6LcR7T2Kk3UvJkfgiOXcAYyhpj8JysukjdLu1rHt4UAWUqx/RfuIOPZMytLfApuyL8Gm7kZdpz32npRG6a04ufQBSDaFBDxZekEtJsfBsD0DwLPruYVyJmp5D0sgn4+7EmMr2nDCBHro94pOX5tyFE+tlhnFRK9dKuPzVUAQrqOW57DaE1EIjfwDXsR7nSv2fkTcFV/v/imWeKTEcu3oAy758evm/+7MxZckH5XLF4Jb4hLUl5GA==;31:fmZBxf2a0XqlsS3Tma18ZenxyWqVegQkE3LorTHA/IEJ1L0/cnYyXlUzTgt78JiDrFSswGuEWQzHOTD+/U7T7/oQiCS3RuQiUoy8DabLuAv6vWqy3a5I2kjnmDe7akscXXy51U1cF3/F9eQNsSoB4N+k16jvR8DkvnLjGuE5ezV+gFu3HR0RPJ4SIYerdHfNCbl8q2TmUWsR3z0yXTX1/fgqd675zHWCLzKxzLUdLf4= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1981:|VI1PR0801MB1981: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1981;20:H4s0VgGySvPEPzO7eXmzVtTkKKC57hJjFBABXzqAL8pUwTrBaj+36qCsAUtn6jVaF+Z9/YPAs3vLOQCRSTmRVroUJSrt5pnrrN0JnJSAZnSJsxKvsuFh+qfrb3+ggPMXccktx9upVZ3EKyEZ9l0a8SPUAFdnZVV++tksN00M3+2XJPa73Uex7xfDSLAuvaFM2aB6saci5rLpitoy1TiVhytNZbkCiuHTbL4uKvVQCAqWxWoNarjb9hg7L11T7VqP10pxrSCiOgHtYxIllccXbWSeqFEELITH7y7bp4pCD2t20TRn0l6jS7zgIL9KnBBnQ1omA66I+/Iik7y+QmM7vUJiasSYabixE/yM9lvmTcDM3VTm0EUwIjfH5r1sYcF43sfZx0428HZw4ugOJBrGWzYOGJtSOojVZjUVA6eCMkVvbf6rdlcVoXig/jJpAg9wUOIFPguuSsl8360ZyK6tWCITxREh8bQ/dKT4E31HaHWjcfBsF3pG3hL0Z8ipwTDI;4:Cm1lVbO9Kl4kyMmc0AwFPBO4S5acm04l75absZ2SA+0QsgaDmDlj4t2BK8faw3lEvSEIE+TWrkv1ECd3bdzVT9AwNE3eGhiRvu/Hfhvk8MI574GYB/nKhiiOkuJAuzft+ZRG+hhvMkDCqsW1RpPC99MMNgv4Qzt+tul2x0f7r8Boiy0WAB+dK0KGCAQPOzefPHpMTKOGYRFnfZSXiGupZh1RSmb2U5JIJokuBx96Wfi/hGiLqRvcojBWfglOfhF5jawug39mtXbX6aYvBQVr1g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501228)(52105095)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:VI1PR0801MB1981;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB1981; X-Forefront-PRVS: 05986C03E0 X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(396003)(39850400004)(39380400002)(366004)(376002)(346002)(189003)(199004)(66066001)(68736007)(107886003)(4326008)(47776003)(55016002)(58126008)(6916009)(6666003)(105586002)(2950100002)(8666007)(97736004)(33656002)(45080400002)(16586007)(25786009)(86362001)(53416004)(229853002)(9686003)(54906003)(1076002)(386003)(6506007)(2906002)(53936002)(23726003)(55236004)(6116002)(3846002)(186003)(16526019)(305945005)(5660300001)(7736002)(316002)(26005)(59450400001)(81156014)(81166006)(76176011)(8936002)(478600001)(36756003)(50466002)(6246003)(106356001)(7696005)(52116002)(69596002)(8676002)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:VI1PR0801MB1981;H:rkaganb.sw.ru;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB1981;23:9FdlMY5luy1iKwjXroYwQoRKlUHGsC0owRKV+1z?= =?us-ascii?Q?B100Pvz1vPlgV/+gyCynnzxc/PBXsR6VTmMrOXV4y0vpAHaEw9+1zzAjj9wy?= =?us-ascii?Q?BF2Cc5pNlIgD+CilBOQIdjrJVD+NHU5WfESkjrpeKhhbBZv+7OyEx3UX6qQK?= =?us-ascii?Q?kRgny7UgWDoSS2bOLcc9n5292v/LEpothMmiAif44zkMtbwOyY6ZjF/d0CY6?= =?us-ascii?Q?/abjfCRHDpiQc+LHtfm6vCIvgxdA17cgEQvmN+zi6TpO3OOvTivqSaKvYidx?= =?us-ascii?Q?0OKRMAEqhAtJtSVj1hUH2ETga0GNkoLRLXIseKyqaD6FA1516bEVt5obUHCR?= =?us-ascii?Q?1u7soYBMxE1zWuCTQmmEYtjOhv4oOxANTm0htrKgxXmY9MpyZovevV3nm/fS?= =?us-ascii?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T2dCFV9xVfGg0z+pNPU10geH2PRiSoz4nliSzuI7rcJ43OhdvUtAvwtQWqQrmEbM5r8pcMDLTadxPGHR1DUA7vnqI9/1RgYqNSye5kp8zM87vZKXkdOV3yYMzQCSasewC0uWEzq6bjlDbk3Bjn2L7/PFGAtJYAXxxiO1SRbG7IYaBuZzS+5dty/GA;20:9E1LwIQedfaspj/Tro+J/ShyQ3FY7j2W45Z9d57F71/zoeBwWy4wPr01DTn7LP+WwYU59WJuaAeQuMeFvn63ZrO8XuTP9FHa4iKhxlHZAS3PrH3BHrRXWmTV7cHBv2NLQBd41Ospw6A02pyVpoSvBGhUju2SnyoPA8ZFND3w4v0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2018 14:59:40.2627 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11c158cb-f70b-40c9-c5e7-08d57f850f85 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1981 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 01, 2018 at 03:15:14PM +0100, Vitaly Kuznetsov wrote: > Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following > trace: > > kvm_entry: vcpu 0 > kvm_exit: reason MSR_WRITE rip 0xfffff8000131c1e5 info 0 0 > kvm_hv_synic_set_msr: vcpu_id 0 msr 0x40000090 data 0x10000 host 0 > kvm_msr: msr_write 40000090 = 0x10000 (#GP) > kvm_inj_exception: #GP (0x0) > > KVM acts according to the following statement from TLFS: > > " > 11.8.4 SINTx Registers > ... > Valid values for vector are 16-255 inclusive. Specifying an invalid > vector number results in #GP. > " > > However, I checked and genuine Hyper-V doesn't #GP when we write 0x10000 > to SINTx. I checked with Microsoft and they confirmed that if either the > Masked bit (bit 16) or the Polling bit (bit 18) is set to 1, then they > ignore the value of Vector. Make KVM act accordingly. > > Signed-off-by: Vitaly Kuznetsov > --- > Changes since v1: > - Drop 'polling' bit check for now as we don't support this mode. We'll > need to bring some form of this check back when polling mode is > implemented [Roman Kagan]. > - Add a comment explaining "!host && !masked" in synic_set_sint() > --- > arch/x86/kvm/hyperv.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) Reviewed-by: Roman Kagan