Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp560929ybp; Fri, 4 Oct 2019 01:02:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDoVZlNMRnXs9850ryEbuRh1p2lvnu1Nw7VPk5pCo/M5KPgfdUQ7tcbkKAj/nrIXYcCJpN X-Received: by 2002:a17:906:2a86:: with SMTP id l6mr11054023eje.120.1570176166262; Fri, 04 Oct 2019 01:02:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570176166; cv=pass; d=google.com; s=arc-20160816; b=AeJ1eyTY5bea7I1RdJAApLSEw4FnkAikQgajmDH8W0pt05Dt1W3z2+VyqNzTGtyOIG K6CzvTz77PVcsVvHBav5uj+qilXWr4QJ2dXOoZF7bj2xUFEPW0FfXImMTx5zMokOVvZh k5KSzZtGYwBmO38m7WFFyVYA5B3Upn0p1PQRmLdh7xhyEgdn+oyqkCU4+jZ+o+w+HoI7 xtTdVs/yBCxLvCVqDMAUfomBvsKkfLnvBm6CxOYR3pjOatJKifEMxe6YAeOgLJcdAdrY 0Gw628z3/pSm1W2dfuJrQ9OlFNkZEqjTBlWEetT4kvoaiwQEM2GObGV+m75PxVKAmyUE v7mQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=LEEKoRHdFuhEMJGb/9H5pJYEJzF9NuDgCp1bKNvBYjY=; b=sGuu/U/noRcG7RT3Y8f7mORBPwetqRochYyk+wNWgbH4lNokI8MOBtNlXQgIzzDPEK C6tSzup/QTkUyP3N4ZN0ZwuBg46y5jPtmqzzbXnCCSU/hKV1m/NoK2ziWnFBVpJCZswt qXWtYdHblpLwJSWI3iKsSVixoOu3y/HFXBEacNzzgkGRxR165te7t9CF9wiAKqPIwcef YFA//G3mQURQwlj50Ck8/bNjta9+Vh4TqfKwAUQWdz7gkITc096gBPxWcbbqq6Dh/SXU OvJtknZUzgjcBLerjI0KmlCCDTD31JfREIL0q3fQ5mD53goGd9CvQA97JJeC5Ip0VNAw Wxew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=JMSHE0y8; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16si2786836ejo.255.2019.10.04.01.02.21; Fri, 04 Oct 2019 01:02:46 -0700 (PDT) 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=@microsoft.com header.s=selector2 header.b=JMSHE0y8; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732543AbfJDDB4 (ORCPT + 99 others); Thu, 3 Oct 2019 23:01:56 -0400 Received: from mail-eopbgr730129.outbound.protection.outlook.com ([40.107.73.129]:10015 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731648AbfJDDB4 (ORCPT ); Thu, 3 Oct 2019 23:01:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HtIbbD9aMHiieYGkx/QfZxCDi7/dsFT+KfBcKhBi4BPMHC/+hpDIuWo775UJDK/6Rijcr402HvzLibvmdmHZRp4jHD5BRwcpyWxIxIzxDNuThpUMZz2TDI+hWTRksUummG8x4IyE+sus2i2clNvxw1I3OxNQ9HdS5Le/Z0amrtoi/ZwaVlyGiFR1xdyc2pzlt0QpB1BHrzg6toDyt0Wbh6tYUolDSByBkrehwtAdMytlxN1crGu2Lwz06ncnUC+lvEgdETiNR2Jqa4DWNWY5BKqVKcz6utRgSDtNhbVLfJQqzYmr+FpDbe0RASS/HuW/Lh/V+nW9Xz5QplV64WhmoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LEEKoRHdFuhEMJGb/9H5pJYEJzF9NuDgCp1bKNvBYjY=; b=IhC1eyCtbsUQoba7TiOnhLWhJldatRsPLQ0YgqoDGlsiEHVfYfmW78DRHmNYJH8d3BZXyTj/1X/Gyht084VpYiSqL+0YwJdVGkWSwLl9eb9m4yY2PLf7rLOHhmLsT4XRJ3usHh6JUysjOpFCtuB1aAcA59IqKs2RfDz/Q38IZPkOoareEWT6pWqbe9W5/LBonwACCcOkasVXlaYpaM3GzyoxhEszt6FI7NEYoptjPCH6uZ2tVT/zTVx+1tFlDMTFKTGa4v97HUVE6WC5QGm0IKDYMji9lpn2VP1/FudYCQD1UYsxZRzo0BoEzAP3bev/XohnJZXmCToeBonUDwlC7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LEEKoRHdFuhEMJGb/9H5pJYEJzF9NuDgCp1bKNvBYjY=; b=JMSHE0y8ttab04mC2qx725UnGkTXeSffw6KR3JBZSEeV3Ij1lTRVPluUsrmNHJ6RSDnQSloyzMQApdXd7hP4ATHqdIeFXYgT2qBxck6V8y+x0rVHYnRL0PzOIX59eFY/9zn5NKTxU6FQ9GIm7094xTSRtXRoGmnjxSqNiu+gpAU= Received: from CY4PR21MB0136.namprd21.prod.outlook.com (10.173.189.18) by CY4PR21MB0503.namprd21.prod.outlook.com (10.172.122.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.3; Fri, 4 Oct 2019 03:01:51 +0000 Received: from CY4PR21MB0136.namprd21.prod.outlook.com ([fe80::a849:fd6f:615d:64e9]) by CY4PR21MB0136.namprd21.prod.outlook.com ([fe80::a849:fd6f:615d:64e9%10]) with mapi id 15.20.2327.009; Fri, 4 Oct 2019 03:01:51 +0000 From: Michael Kelley To: Roman Kagan , vkuznets CC: "kvm@vger.kernel.org" , Tianyu Lan , Joerg Roedel , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "x86@kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2] x86/hyperv: make vapic support x2apic mode Thread-Topic: [PATCH v2] x86/hyperv: make vapic support x2apic mode Thread-Index: AQHVeQrgrl6z6kaUqkyr6D3zFBAn2KdIv6eAgAAhHwCAAOlpQA== Date: Fri, 4 Oct 2019 03:01:51 +0000 Message-ID: References: <20191002101923.4981-1-rkagan@virtuozzo.com> <87muei14ms.fsf@vitty.brq.redhat.com> <20191003125236.GA2424@rkaganb.sw.ru> In-Reply-To: <20191003125236.GA2424@rkaganb.sw.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=mikelley@ntdev.microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-10-04T03:01:48.8514527Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=2c86c3d7-269b-4811-836d-90d0280a7900; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic authentication-results: spf=none (sender IP is ) smtp.mailfrom=mikelley@microsoft.com; x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b079f66f-93d7-4f18-b40d-08d748773460 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: CY4PR21MB0503:|CY4PR21MB0503:|CY4PR21MB0503: x-ms-exchange-transport-forked: True x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 018093A9B5 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(366004)(396003)(376002)(39860400002)(136003)(346002)(199004)(189003)(486006)(476003)(11346002)(256004)(10090500001)(71200400001)(26005)(55016002)(71190400001)(229853002)(102836004)(9686003)(66476007)(66946007)(66556008)(81156014)(81166006)(446003)(2906002)(33656002)(6116002)(7416002)(76116006)(64756008)(66446008)(66066001)(14444005)(8676002)(8936002)(3846002)(86362001)(99286004)(305945005)(4326008)(7736002)(5660300002)(7696005)(6506007)(8990500004)(74316002)(6246003)(478600001)(10290500003)(110136005)(25786009)(22452003)(6436002)(54906003)(14454004)(52536014)(316002)(186003)(76176011);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0503;H:CY4PR21MB0136.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MvXEm+gaQ9YnGGKfXLN+VOdowGneiRNR+QBa0dvkwkwNT6Xyn6+prBJx39631Lo51/WQku2fqL9TszpbrGouDfSO6ENk70Ww1i0SVi/s+iWh1Z6sr9XO0YMAS7DLPC+Gee0R52BvG7OV6BgzdOE+Ug6IoC1XZZASmqqI9OcSB+YlURnn2K31kF/9n1fhHqTvhbwL77fS6UQzVL5Hr47fH5sCNWeAzEJg+5TjnB3IvrgFsuyj2fbYKfxQOWZzJkae3tdG6MYszaaoAcbMeSD5MRFu2cg/Sk7S6IH06KxgOvbBM6W2mGNy/rrYGngWXSndXjbav1saHcJPEWO+CtSzGn/DEBOMFvHYsUeGjMz0BTkJPKjxOfJz/YNFReBXyaXoxZ1iB8Yzbg3fgSCffzOAxdV2zZSUk3BGmKaYtVjbaww= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b079f66f-93d7-4f18-b40d-08d748773460 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2019 03:01:51.2005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0gFGbmjC3MyH2kC5A4RE+XP+1Xj8RvQ7nYeCeOvXYJ242G/bAQvfo3vk8shVF1OoHE0a9UixBJLGKT7QNH21NS5WUEv9u4aFbPVU+AKWfOg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0503 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Kagan Sent: Thursday, October 3, 2019 5:= 53 AM > > > > AFAIU you're trying to mirror native_x2apic_icr_write() here but this i= s > > different from what hv_apic_icr_write() does > > (SET_APIC_DEST_FIELD(id)). >=20 > Right. In xapic mode the ICR2 aka the high 4 bytes of ICR is programmed > with the destination id in the highest byte; in x2apic mode the whole > ICR2 is set to the 32bit destination id. >=20 > > Is it actually correct? (I think you've tested this and it is but) >=20 > As I wrote in the commit log, I haven't tested it in the sense that I > ran a Linux guest in a Hyper-V VM exposing x2apic to the guest, because > I didn't manage to configure it to do so. OTOH I did run a Windows > guest in QEMU/KVM with hv_apic and x2apic enabled and saw it write > destination ids unshifted to the ICR2 part of ICR, so I assume it's > correct. >=20 > > Michael, could you please shed some light here? >=20 > Would be appreciated, indeed. >=20 The newest version of Hyper-V provides an x2apic in a guest VM when the number of vCPUs in the VM is > 240. This version of Hyper-V is beginning to be deployed in Azure to enable the M416v2 VM size, but the functionality is not yet available for the on-premises version of Hyper-V. However, I ca= n test this configuration internally with the above patch -- give me a few da= ys. An additional complication is that when running on Intel processors that of= fer vAPIC functionality, the Hyper-V "hints" value does *not* recommend using t= he MSR-based APIC accesses. In this case, memory-mapped access to the x2apic registers is faster than the synthetic MSRs. I've already looked at a VM t= hat has the x2apic, and indeed that is the case, so the above code wouldn't run anyway. But I can temporarily code around that for testing purposes and se= e if everything works. Michael