Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp806790imm; Mon, 9 Jul 2018 10:59:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdogSKTW0WDK4U+DHUVwsWUX9Ljl2C/PXOGUirKzEbVUUSRZqxLFElyUZVRS0ipPKToam/H X-Received: by 2002:a65:5cc5:: with SMTP id b5-v6mr19490927pgt.425.1531159145386; Mon, 09 Jul 2018 10:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531159145; cv=none; d=google.com; s=arc-20160816; b=Z95A32IZuJUleNq12uoheatFsjIkSE150AqFZhpcFJN/CU4NZ6uBtUkn3tIGB8q+S5 sL6QOQavUCYhjYUDRFqHBvkgrT/Z4bDiQAAIsJWLFYlsx1NswZ8Jsukl8+C5UJRmIY3l TGNXpamjkovES1/ZFD5KlCX6ELGRR3mA4cLnSytHBgjz9vy8IuxnaYIDwysrGhhsNFgx b8uC2Zv4OGmkNp/JnN+nn9SuN4EWdyFDEgtGmIvkdWxVEYwJJBBZ6KmtMA+fv1Wqu9nX nflj0wLa53kLSgbAEoKiZo5vNSDe7QBUcrDiduB9iZjaV89ExlTJoqfCcrHv/T8bDhMT llow== 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=+JTart2/59TLTLmyqXH0266FGKOaZPkhvp5FGrDSNBI=; b=OBjWNZ1c1UKiqByDSG99Vg9AdSujiq/rDGV9gnob5CTYTmyqdTFI48QE0IIEYQbUNU cD4TKlfvznjUVLnrl0aIVTBFsnycWcyyIKZDppIu+4e9wF0xrgARaqZSJgnDkdhC7Fvn d5AvG4iIIEJrCFnNkYiBeFcSsqLmFluTg9Ape6P9DqdvFWDEVCmlyZR3k7kfsv7u3+F/ ft6wwT7S6NocbKkuO6j7py8zsYWtTUYN/PLM8Guskghh9XuA0XMfBW6OGo1lHBXar3nD HpMTmkXEHwKMog7SR6KC+XoAZ+42lb8yUGSw4j3DbEGPCi7Pq49B8aAh1Bf3zMJyJ5+1 2J/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=HZAvXbWw; 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 o12-v6si15530192pfd.142.2018.07.09.10.58.50; Mon, 09 Jul 2018 10:59:05 -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=@virtuozzo.com header.s=selector1 header.b=HZAvXbWw; 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 S934099AbeGIR4m (ORCPT + 99 others); Mon, 9 Jul 2018 13:56:42 -0400 Received: from mail-db5eur01hn0238.outbound.protection.outlook.com ([104.47.2.238]:23261 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933771AbeGIR4j (ORCPT ); Mon, 9 Jul 2018 13:56:39 -0400 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:X-MS-Exchange-SenderADCheck; bh=+JTart2/59TLTLmyqXH0266FGKOaZPkhvp5FGrDSNBI=; b=HZAvXbWwEqjvySMeG14385RqSgTyOFSL4Qis9mJQP+3xnr8XzO9DcENmtoQPc5TMPCb8b+LRyDkdndPb2sSA2nJdyyWyIZAtMF0qN6Zpm0vhkL5i2Df67hK+rVNPV1dSsB1OkILOqBdt57iUjoH9BHH/3JkmIXvusyS3e+FeYKY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM5PR0801MB1970.eurprd08.prod.outlook.com (2603:10a6:203:4b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Mon, 9 Jul 2018 17:56:25 +0000 Date: Mon, 9 Jul 2018 20:56:21 +0300 From: Roman Kagan To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Wanpeng Li , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/5] KVM: x86: hyperv: enforce vp_index < KVM_MAX_VCPUS Message-ID: <20180709175620.GA3017@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Mohammed Gamal , Cathy Avery , Wanpeng Li , linux-kernel@vger.kernel.org References: <20180703134206.27240-1-vkuznets@redhat.com> <20180703134206.27240-2-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180703134206.27240-2-vkuznets@redhat.com> User-Agent: Mutt/1.10.0 (2018-05-17) X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0301CA0006.eurprd03.prod.outlook.com (2603:10a6:3:76::16) To AM5PR0801MB1970.eurprd08.prod.outlook.com (2603:10a6:203:4b::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec0b9b78-31ef-4529-1ae7-08d5e5c54ac4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:AM5PR0801MB1970; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1970;3:kstiFC+nE8qeVtA9IY6YP6d2PXAjNLwJmAi1iIdXt83emvJKjoWnRpVNst+Pdb7EA08Q27TVyiYDLk5sopm2xo0y9Ohy18EH6ihflMv12irX7s2YT7juw9kBHTCaf4TCg+POHTaQ9DvUJFBy3ERnv+r2urVVVtci+ufOdenPXI8twcnuz/uvaRFo1h9wMVrOybKEEGen8lU2v4WIxRmjJhJKp0CNadpHB1rJm0/rMDcKE4fLIjYhv21PP3gm9uW/;25:qjI3lBtNkNgNBHGjUyN63Cl308ryOcAcVXjexzswMpGuIJdIF7lpf0R0SANVVD3Pz2/hfqrYH3cz+n/gahPaRpQr3ucmGhtyOu6QZ8GUmytaSxDHP79GEGUK2G/NshQ+h40g2N0glMfdmmx5cufVrbUyEkR4tZSJaCYukhm1j/3l55VH3KUtzf69Cafh+RzD4BLWs+51O6KI8ha/fSq+W/tcxD4SNDkrlyAUVw0KesPuZeGzb118U2qNVhJ0tMzH6RC40TL535+Sg97zBc6z8o1lTnAPg31LGrjWk+X1/cKdmp4DedMjrsNUOzmWc7ZGp0/FtS9iclSpxfNdn7uk1w==;31:GlWFEILdHQg6Kf/wSyomJfkm2DDh3NvYQ4DbWjO3JDAgR6IXQi0i3ObyPdy4nA1gDJPbM6+jf0pUdFdODSRFale1I7ehQrlhZqaWRgkFMLdVaeQb+3i1yfg8uSbx/vS79k66Y2FLoaVICoDBh7YaLdM2K/EWf2Jfw9SwQLpOhLJwhBMZU5dnK1ofHK/+v8TDuu1V2ZkqdQ+SfeXrq26uO9i3Lf2GgDccVPRlIKOIcJw= X-MS-TrafficTypeDiagnostic: AM5PR0801MB1970:|AM5PR0801MB1970: X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB1970;20:VYBY1vxvlKmpBjUaqOu6AXmrwFmYuXRu5QEdvFq31lO1Eo1qSDwA/H7chiuDhe+EQleemTgQLwspuWiL5MrgAN8lgLpGL3xXMerqbjLHZfJHfEFgfZjS1GrYmjcnBa5bnVKiDmq8GwnqHTyGNOVz52cDogNSL3AgfQ+Qqyas5Po7E3QBf+dDug8QJu/mEJlJQczIU12EL0YYpDXG/MJDRJDGl5dYZrygD+eiLUqnR3G8VFkH8l+152VFrUyO7IqRHBhnqyAxbbmjCfSRhJOvsgoEyWu3vVViCuaw24Uc6nWzyeH7/VXZQJHLFqKs92d2TADRDYPsVyyoMT+kNzv38kCvYOR1hao36cv9DxcZzjP9Xgip7vCd3rh9SzGx53/Z59xiV61eb5WJ7VBPq9q3U+3r8Aae1C/Bl8+qu9X3CXyHZVuDfl5Dx0FRBNHZOz2WwpoCX6Q8Y4cAdQ4PdcF0NDLlUD5LD9cweuNGmeByqgwfhlg7BPhasDEM/8O9dPcv;4:Ro5f6XPr7zg390v8zmOCt6e+HLr3MoThk0dIMB6UHo68mSHuNvsLGQQOCF4FeMbqnjrw3S/rg1XaxsAK6RQQ/6HsUIa9DtT9Ahn0elNISaudIhCuzGzDnhDSV014xEsQAmN4dbl3oLHDU6u8tQWPNp729grfvOHedMZGc1qwxs3FWapRKuUPwk66zcNPiq32iGp/g1DNLorLLVKscfoFMHdTMCpRLEvTHMtzevNN0aESAM5iHpg4jGDgRoo3VKNWo6aG6cIkBX5kWlicgAVKIw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:AM5PR0801MB1970;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB1970; X-Forefront-PRVS: 07283408BE X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(346002)(366004)(136003)(396003)(376002)(39850400004)(189003)(199004)(97736004)(36756003)(956004)(11346002)(81166006)(81156014)(2906002)(478600001)(55016002)(486006)(446003)(8936002)(86362001)(476003)(47776003)(50466002)(66066001)(5660300001)(229853002)(8676002)(68736007)(6666003)(16526019)(186003)(106356001)(7696005)(53416004)(26005)(7736002)(7416002)(4326008)(33656002)(39060400002)(305945005)(58126008)(105586002)(23726003)(54906003)(25786009)(69596002)(1076002)(16586007)(9686003)(76176011)(6916009)(52116002)(3846002)(6506007)(6116002)(6246003)(316002)(53936002)(386003)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:AM5PR0801MB1970;H:rkaganb.sw.ru;FPR:;SPF:None;LANG:en;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;AM5PR0801MB1970;23:yEr1giWk0YLsklmwKZBKDbyqdU1f8rcU30hWtPC?= =?us-ascii?Q?txwPaWANKaqp67BDSpd9s67R6Wr357MS4ACo1/1D3RWL08kTieGwActlRn3r?= =?us-ascii?Q?5sTVT4clAgFQ+xmXyf4cKqGLZqS6/Gic79ZmmGR55CbTzDimfmf6UgAgkN5W?= =?us-ascii?Q?GPNz0Eysqk7bojMEFA4q8DTbJfwQgVinBSOnvCUwa8E1GIQQnBvDsHzKRyd7?= =?us-ascii?Q?9FMTv2qgxqhd1QLbx7YooAg10ySiCNiF/utP5vC1XMaYN6My4i5d9L6r+pRj?=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vuOHzoUNdqhCVhkLvuRCw/FdFwG4PQ4BuEVtUpu028tqJ7dNh0xGM33CWKmIHetkUlO6pGM1qkYyByGufj/WUr5ID1Y/pjKXbUIUtlVOHW9TZ7WFVNZZNO7fteAMD+K8bb9XsYBvGJrdIrMvh9Zv5g8+6xGxDmouECpyx2NN0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2018 17:56:25.7137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec0b9b78-31ef-4529-1ae7-08d5e5c54ac4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1970 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 03, 2018 at 03:42:02PM +0200, Vitaly Kuznetsov wrote: > Hyper-V TLFS (5.0b) states: > > > Virtual processors are identified by using an index (VP index). The > > maximum number of virtual processors per partition supported by the > > current implementation of the hypervisor can be obtained through CPUID > > leaf 0x40000005. A virtual processor index must be less than the > > maximum number of virtual processors per partition. > > Forbid userspace to set VP_INDEX above KVM_MAX_VCPUS. get_vcpu_by_vpidx() > can now be optimized to bail early when supplied vpidx is >= KVM_MAX_VCPUS. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) Reviewed-by: Roman Kagan