Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp845162imm; Fri, 29 Jun 2018 07:20:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLTf42I+RPpynrv43ftDZKCyVBmNxA8OvIWVM5Jb0azkNMnSb9m12QNF26BWF2SVj0u84sT X-Received: by 2002:a65:40ca:: with SMTP id u10-v6mr12577547pgp.2.1530282001935; Fri, 29 Jun 2018 07:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530282001; cv=none; d=google.com; s=arc-20160816; b=hXbDiPAKH6NDWVXdkQFGQSnMW87mpveh0Q3G6neFxanI9gzLybL/g2YITnGYtHa8Xw 9eHLAuw66KBIsJSw9fyz4wOQHLJflzNbP7a9OTXmO2pfqGctsjpA8HStf7EqRbOLEaD1 irkppPfR98EuBqU2CbFrfzbu5vmOsUuXRIbIYwAFOTTQ73SC3ylW9o6ClL1RZx14JJNU XbMehrj3vabyTD3PfQMluE/I7njC30tIdGnSTYPobn4qNJy8+ur/jEiW2lFiRDHNH163 l6KZ6Mx/qOFmeBg8pe+D5PmPXYXooM6saDoTwGL6CgHE+nPOI+/ujDcXTZ5KV8L6XXEa tPFQ== 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=Wtsav3SqMkp5fX9ys+J3A6CCXUiCNl4fB77+5sAbMWk=; b=qOrJItDwNKCJXkiPS2OM3JE36/IlcV2/JV6b5yZr4OSQdxRqU6qwmYHnlWNxpLO415 deDSS4hqsgORDoqBfKSwwfjQerLo40Ga6TJDO/BcuFsgUMzyJK9CRjjoG0UResCjfT2z U+Q/KFal+P6Rc7BPhMoDQ3IXFTj2dMXA8CpWP8pPRm/0bwE6acnBN38dhIgjEMvYLoLg rrXJm14ux9eW+OohybAswjrtX1S6g6FC2ldTuxvTPLkPKlyUaJZZeIiMjqIy0y2dIFH1 Q9h+XdQiPCoh/o947sXhiF41h/0j4NhVnES/drWpSNn0qlEDRMjnAhDrcT1wNDi5eBUH Racw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=bIZTr0nt; 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 80-v6si8143910pgf.604.2018.06.29.07.19.47; Fri, 29 Jun 2018 07:20:01 -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=bIZTr0nt; 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 S936392AbeF2Mwh (ORCPT + 99 others); Fri, 29 Jun 2018 08:52:37 -0400 Received: from mail-am5eur03hn0204.outbound.protection.outlook.com ([104.47.8.204]:51456 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936372AbeF2Mwe (ORCPT ); Fri, 29 Jun 2018 08:52:34 -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=Wtsav3SqMkp5fX9ys+J3A6CCXUiCNl4fB77+5sAbMWk=; b=bIZTr0ntJOUttT/n+89gm2jjp1tOtFJu/djMedfUpwzWZPfI0wpudMQefHuY5VMVX3aMQ7c+TkMUDK5V9oxXS9c1LR9xKhTWuYzHE+N+yZrZYSKu9wpqfTKeX4YN2fcX/OeU4WIvsONE+4yeHy2VNVOsZnhAj62jEd2QPpsZZvs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Fri, 29 Jun 2018 12:52:21 +0000 Date: Fri, 29 Jun 2018 15:52:16 +0300 From: Roman Kagan To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, x86@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 v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping Message-ID: <20180629125216.GC15656@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Vitaly Kuznetsov , kvm@vger.kernel.org, x86@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: <20180628135313.17468-1-vkuznets@redhat.com> <20180628135313.17468-3-vkuznets@redhat.com> <20180629101134.GA15656@rkaganb.sw.ru> <87y3exdh2o.fsf@vitty.brq.redhat.com> <20180629111227.GB15656@rkaganb.sw.ru> <87tvplddrr.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tvplddrr.fsf@vitty.brq.redhat.com> User-Agent: Mutt/1.10.0 (2018-05-17) X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR02CA0106.eurprd02.prod.outlook.com (2603:10a6:7:29::35) To VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1168e804-2084-46ce-e118-08d5ddbf288d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB1983; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1983;3:giS3HNVT8fEp50ltsZjXRSUH20nK517ESrqThKbfPKi5+OiT7xs1gYH6JnslyO9HM3nUnYy9yroV2uje3tsInGG/HfabPkxi5oMiVqGyK7GnOhAOru2zefkfEHrwOHXQAmDv/7QbVytoOuBktdJBh1zEmnbiCXK4IoXBaUZvEpdGkUnEug66zhO+P5jN1zAzaslrp/46poHPVNQNw3KK1AO4j+0T2CUn4JzJg2XXRBkg7fIaFMZFFsTY1ml6Vpl3;25:cXbQM4i29HS1Epyth5maJ8dgt2rnFHG1x3vDF1/wFCILnNQ55qD8TbLdmFpIoxFMa333p7JGC5EY2Vs64NnHSJYHDmsyeC/MUjrcOpol3RM7zCs0jbBjGsf8GrGp4h80eQMWVP3jjQy9FqFL35/VK+Fmkq5kx3MshSbLondOLrWxzRYlM7TtcY3CFtNXhpfDLg6sUhMl1Z7KAbFV7Uf93ts+38IrxD2KsmMO2FTOMab1x5RaqIL1Sekm8Qz8YMTr5V1DcGXyImxr10fU4TBVJ7ikqkpamftlWCxt1P7fRzVxPxrc/n4D1s7i4Goc3ltiAT0w8ZTyxDba/YQ91JWshA==;31:Tbu09OwALVcLKURm8PCFDZ2GH1nGoS6KpyWRul+z9ItcZssWJkFULcXGc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change-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB1983;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB1983; X-Forefront-PRVS: 0718908305 X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(376002)(39850400004)(136003)(396003)(366004)(346002)(199004)(189003)(69596002)(66066001)(86362001)(105586002)(47776003)(53416004)(2906002)(8936002)(33656002)(76176011)(23726003)(7416002)(6116002)(1076002)(3846002)(6666003)(478600001)(6916009)(97736004)(52116002)(106356001)(5660300001)(68736007)(7696005)(6246003)(53936002)(186003)(316002)(16586007)(26005)(39060400002)(4326008)(7736002)(25786009)(58126008)(54906003)(93886005)(9686003)(16526019)(956004)(386003)(6506007)(36756003)(81166006)(81156014)(55016002)(486006)(8676002)(11346002)(50466002)(229853002)(14444005)(446003)(305945005)(476003)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:VI1PR0801MB1983;H:rkaganb.sw.ru;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB1983;23:PAFCYVoLSVadNcMSI/zgcF6G+Rv2hHMrfq4xv0N?= =?us-ascii?Q?oD6VoE6/CkkzmihWaEwncXnHKTsybxtDdMsxU+lO1VYg6xZRTC/RHwu9l2T9?= =?us-ascii?Q?EKaFsbk8K75JDdOjjWypFj03uD6z9UPENrbo9D7ubY4yopBsw0swpzzk4p4l?= =?us-ascii?Q?6hrWy+arYJP0fvPmNWq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81cJj/prLRe5peY1DzfmHdcziDd6aFQoDcyzRkvGbl2CZwhDxtX2Je7oaddNO6g4T92o83g0p/ua/lh/0fzA7AUrN9mcTUIENozLHhatYhHOc;20:NYKB9xsjDHs9cTvodHlc3xvHrLw/LIhV66mNV6NZJ3f7RRf+a1Qc6J+vtKdQ08n3fFpcMcqe+Eg+VnctL7Tll6wwrXy1rhT/fO+9zDppSZ01HVrJOBOACoKtVsVs/Y2xcrF5uS0kSJGDEJ/ZBKYlN3OuYGfeWHBt3EOo+EBOEYg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2018 12:52:21.7921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1168e804-2084-46ce-e118-08d5ddbf288d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1983 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 29, 2018 at 01:37:44PM +0200, Vitaly Kuznetsov wrote: > The problem we're trying to solve here is: with PV TLB flush and IPI we > need to walk through the supplied list of VP_INDEXes and get VCPU > ids. Usually they match. But in case they don't [...] Why wouldn't they *in practice*? Only if the userspace wanted to be funny and assigned VP_INDEXes randomly? I'm not sure we need to optimize for this case. Note that the userspace can actually do nasty things with these VP_INDEXes, like, say, have them non-unique. We need to be resilent to it, but don't need to optimize for it. I think I'd rather have a warning in kvm_hv_set_msr if the VP_INDEX being assigned is not equal to the vcpu index, and start worrying about optimization only if this warning starts being triggered by real hypervisor applications. Anyway I don't see an urgent need to bloat this patchset with optimizing this translation; it can be done separately, if needed. Roman.