Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp675329oof; Tue, 25 Sep 2018 03:11:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV61StutFic0JYwZ8BkbeuauUYNOJatu8ltEw0GDlmh0id0lcPxLdrBL0OQutOhtUWruex7EV X-Received: by 2002:a63:2703:: with SMTP id n3-v6mr330010pgn.113.1537870283696; Tue, 25 Sep 2018 03:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537870283; cv=none; d=google.com; s=arc-20160816; b=aFLc5O8vLN49EKKSMhU3hZSUuEt1Hj9QPQS1chAqxHXlZM8Oj+lsQBzQmzn+K0So/H E4nuYv/ioKbYVTo3LYIj9M3p07iwwbdPCUo+QtIhb4DPjFVVVZTVqzD7lT5lAJ4bzubE j/3Tk9BWfczkI+lqg2eckgj+BaTpEcQp5SFmwSLNH1y6lgCWNLwmPhJYm9peyGm5Rz9A atRITfrl3S0lKweb8wzdgGW2QgfL0pilra7MAwFL8XfcUDZKRLC9rOnENvNWotSWOiA9 SOKrREr9Z5zlfBeviQvPgOV3ivnsp090OpZvSt9TUFl/Gk/vQF4M7xKKSyyqk5oIcMxS /ZMA== 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; bh=/MCVtRLdWwgWbSNc77beLVK5jkFCQaeWcnzsRsh/ya4=; b=BqV9qYwvjjl7fuAfTR3MD7+BtfFDtrU0H3YVIGgvClKxlobDr/JKLju7zllnAxK2tn Pi87G1z+wORjkTVmxbzUKhDBJM88fbcYeydzJnn303cyDGD79x2u3q8U8b8AycN7yCwI KTQwoou5jkmTqjSDyczTNQJXNoufIuM76VQUcMI4BodD4it8sCIqBo7mKE8uFIeljLxa uDjUhaYVHnGI9FOTCVuzj1gP0vz6Oa/Kh+gMa1Ml+3E3l5ewrHTQ5XRsE3QYHp2Yndem B9JYzUSGPzJzMFak/kdGRVDBEMYoSHTSHxRZ4JsgNKGJ5fUtGpfvvFioNcXrrMmt1XYB fYPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=HVOU096Z; 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 w11-v6si1714211pgs.377.2018.09.25.03.11.07; Tue, 25 Sep 2018 03:11:23 -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=HVOU096Z; 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 S1727441AbeIYQRu (ORCPT + 99 others); Tue, 25 Sep 2018 12:17:50 -0400 Received: from mail-db5eur03hn0213.outbound.protection.outlook.com ([104.47.10.213]:12217 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726125AbeIYQRu (ORCPT ); Tue, 25 Sep 2018 12:17:50 -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=/MCVtRLdWwgWbSNc77beLVK5jkFCQaeWcnzsRsh/ya4=; b=HVOU096ZYI3QSqMSKDrklwmNrnkMmw2yboqAJGLR8gL/FO1MLyZdZHU2Ggo5dpwseLZJSIJn9Tsbi/mRGAiCRoGOk7ib6dcFv0hMTJUyNQR3CwhLmhBgRNBJGgCAWZGwiDu470g5VRRPQiQQkdLn/42vzN89ueXTI/0soGVb2kc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by VI1PR08MB3599.eurprd08.prod.outlook.com (2603:10a6:803:85::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Tue, 25 Sep 2018 10:10:45 +0000 Date: Tue, 25 Sep 2018 13:10:41 +0300 From: Roman Kagan To: Paolo Bonzini Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Wanpeng Li , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb() Message-ID: <20180925101040.GA2336@rkaganb.sw.ru> Mail-Followup-To: Roman Kagan , Paolo Bonzini , Vitaly Kuznetsov , kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley (EOSG)" , Wanpeng Li , linux-kernel@vger.kernel.org References: <20180822101832.31763-1-vkuznets@redhat.com> <20180822101832.31763-4-vkuznets@redhat.com> <8da03d2a-5405-f363-f081-e4bc46b106e3@redhat.com> <87r2hs7cco.fsf@vitty.brq.redhat.com> <87zhw62797.fsf@vitty.brq.redhat.com> <74055c3b-be66-4ce6-e727-a155f18a0ba1@redhat.com> <20180925085752.GA5391@rkaganb.sw.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR02CA0090.eurprd02.prod.outlook.com (2603:10a6:7:29::19) To VI1PR08MB3599.eurprd08.prod.outlook.com (2603:10a6:803:85::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2446d02f-9183-482f-3777-08d622cf2989 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR08MB3599; X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3599;3:JJlVmzSRIOLw0g3LrUUcJ+BIQrlYbLrfPAgTWEtHcBjS0mAnyQNcnwSHcgpBu1uVSKVEUb/AdxON78YUvjK6RvtxeTY2dRu8rdTeot1v8IaXGrOM25RNBIbqMBKwbQq5Y5Ki9wunpVROJ2B/2vxGWP61q3g0zMKJnR94bvyCZpCqdDDz6i7g4YvRVwl/0pnYeahShd54h8zVQAkpbJ+E2V9G9WgpU+SqC4mlRCKozYpE62hszlWu5nQnuBsMXOLM;25:YPwv/5gdaLsmW4nv3eOFXJsD/1KE979cP740uDGn4x79QdmD/4KCpOWKpRQOyxcRmqudOnwHTBDHc5qcTYSowzFjgJMDLxJjYNWl+MassgYf4le8e+Qc3fJ49Q585CGI/7DfVzFpwXRXcJ+BREqlf5UBl7yjJKc0wQpVRlfmRBqvimBPRGwiljHYv4KmMW2YymXJC1uh1PjnGwmZ9G1fgJGsDO8vO0NozGaqxPj+koK8tX6Xued8vhSKPW+7rSVo3cN7FmyhH0+TXeoGXgkvsG7iUkE184OLv0T3fUo8JMIT8J8/JIueAbF+LSs+/+diZOktMY3aq30ozkZi17/Kyw==;31:HlBWVSvroK7kXzhTlOsgur3maF4c5Ng4iK8dnHtKn4MahvDl32TMLc89sP+ryjhW2OPR74q69/59/RmJ1bzwHmsGCQwXIBgyEmCCVAGqNphDi7H0hJnuLg74iBsJh3uYGPG42EKS4VF+3DgMO2UacE5FCE5+Uwf4jiB8E7coWtGmgQaUM3EbMF2vzxUgI/AXzPSLCeZZQz8hM34giMkfFhM6sL+gv/K99OlbIKzREuI= X-MS-TrafficTypeDiagnostic: VI1PR08MB3599:|VI1PR08MB3599: X-Microsoft-Exchange-Diagnostics: 1;VI1PR08MB3599;20:NXIWW6WuXeUALIklqNk9Mk63ZKUu8hhAH6Gh++/ZuOxqdjDf4N6f90NYJCvFIQSeEgAPfgRk2ClYb8VUw6O48Oe1vhKDrOTPlSHt+AhTKOHFWPDCHWZID4l9oupsYRckuJWFMekGqIb3srH+5B9MMnNREwVez6DPtLUPbw1Il6ghTc0xAyhHmY+iCm2TgIP2yLAP8B7qJIFEXVz0lLYxt30T4u0tAX/PBG0WN36qfwVXEq487BNqUDMp3sA9c/PWGGGsW4MN9enHpZanBO0kqbS6/tABWwBBLR0eZRxXKBSTw7iYHrkJyZLRFdX5mnhZfmEjL26iZjnOYKp31jIkbbEx68fI8Woht7YOtWbK0UlSJ9PTJYB8qrwC0/3Q8dayJ0aQxAXVa/r7HwHMALJKl4MutXIO5okYLOMjeNEsiOX1IJ6y4B7ROj8Nb1K+4EXYcPvvOfkHMHgSq1U0e0wRuSXtuXIfyHfQJ2jRkXsyRvSke8Mkoc5p9qrwOCit1e88;4:2jRgrau+l5KlChMnVDEoYD4kfiy74/FfmdMC3ceE2ZpzTtAL6kf+ANDKUvIXbGBYikjIODraiONWoRCfN+evj8YZC4H7DRtPT5m0keUQIMnySuf0CcR23WkzmfeYBbysp3BcVdIjpTUa2xN5xCXwOQMsN3iykZV5xwqf8/vhJ2UKdGLApZ0Wefu/wQzU6vga7ZZsK3zpLTkeW8XoeV7F2Z79Y0j+RJ+Dapr8qCGb2vfAawGmVCwaGwiINbaFHEIzEKGA4XIhFzr2txp9SDCwaQ== 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)(5005006)(8121501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149066)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051);SRVR:VI1PR08MB3599;BCL:0;PCL:0;RULEID:;SRVR:VI1PR08MB3599; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:SPM;SFS:(10019020)(346002)(366004)(136003)(376002)(39850400004)(396003)(189003)(199004)(386003)(54906003)(16586007)(7416002)(305945005)(7736002)(26005)(6246003)(53936002)(4326008)(25786009)(39060400002)(106356001)(16526019)(105586002)(33656002)(186003)(68736007)(229853002)(50466002)(55016002)(66066001)(23726003)(9686003)(58126008)(36756003)(3846002)(6116002)(1076002)(53416004)(446003)(11346002)(81156014)(476003)(956004)(47776003)(478600001)(486006)(8936002)(7696005)(86362001)(52116002)(97736004)(69596002)(8676002)(6666003)(6916009)(81166006)(316002)(76176011)(2906002)(5660300001)(53546011)(93886005)(6506007)(30126002);DIR:OUT;SFP:1501;SCL:5;SRVR:VI1PR08MB3599;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;VI1PR08MB3599;23:I1a16eASdsG5wF+pqUmtHHrIedAyHXVX7p7pFa/3O?= =?us-ascii?Q?4cJNkkOwiyewQ7UVUNeCowVmPO5bM4M6q4hpr4okOV3Yqcznrpb8CwmDytH2?= =?us-ascii?Q?2eA17mWRq9ye9uIhM95GfHTg33KshaUaIhyNREhVE40lHFctfqX2NMmbRIqY?= =?us-ascii?Q?Wu5zQ70FyWQfkFoS42A2jfXB3SSLYid9wOgRanqmpvUDfHa5w3j0XKSkvyp4?= =?us-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zInlFzuErTPc9wFw+m0nxemibgObMSvEZHLBgU6l0fhyOVVpPR5CLpG9pL+TQHzzGDinJn;20:sLiQayD0j0aBdpffTcd6YSzV4phqyQlA+F4f/P5tyCilrmAcChwhVdLyQato0Ea8fm3L2om0l6xRIvNeW9nzJuTdm0wrLLKUBjQdMnrMiw1bApyMP9w9p9jx0lyK12bEDChpNGDg/VhqW3iaJyiVWwx1VEU7EEBerrTUo02Jlis= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 10:10:45.8999 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2446d02f-9183-482f-3777-08d622cf2989 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3599 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 11:29:57AM +0200, Paolo Bonzini wrote: > On 25/09/2018 10:57, Roman Kagan wrote: > > If we can assume that in all relevant cases vp_index coincides with the > > cpu index (which I think we can) then Vitaly's approach is the most > > efficient. > > > > If, on the opposite, we want to optimize for random mapping between > > vp_index and cpu index, then it's probably better instead to iterate > > over vcpus and test if their vp_index belongs to the requested mask. > > Yes, that would work too. Perhaps we can do both? You can have a > kvm->num_mismatched_vp_indexes count to choose between the two. Makes sense to me. Roman.