Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3590833pxb; Mon, 25 Jan 2021 22:37:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyRMsuWUjg7S8+6dkdlFKukaiCb3DYgBZwBIk+jQ0I4yTJ7lFXV6QzxS8DCPOG3yCR9fFU X-Received: by 2002:a05:6402:31ae:: with SMTP id dj14mr3403635edb.364.1611643031492; Mon, 25 Jan 2021 22:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611643031; cv=none; d=google.com; s=arc-20160816; b=mAynfQ90Wnhed6laj4VkA0vlwpa3RcLn5lcaMP8pTNKsM4k4QcS+/ceJ504CDkK5DC M0r5Bx4mjVIyyJ7RVazb0J8RDMQd038EeW8fzG45GAfWYhfgw0KeeBgDE4kkxnZRcY0r B93gJwU6oP1v0Gkuxlvk3GBbuSvFrXAltPX2EFMTTUILytknsZ7MpkLrm7FPVfbHeZCo yxeaTXaAzV/muEl3gh5wbfi8nzHEL6F+O5CorOE/GDFDq/ZRXdLJdjr32vRSl/Gswmbw E1kp1yDLL4E5KbtSuQVKazVEd1Tojoy7Ip5+XFuv+xbn+vVpZK4qCxY4VewuTZfjt/N7 TB1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=BDm19Dgi4/R1M7NEkbJlagjzZ3izYV3xeJ/VJoUerRc=; b=mw4SxOorh0uJhTBq3VL46my36pleU820YoyjeDBuZqgT6cP+9VT0sRrpH5n4E1RklM 31a7zxBKG2rfegz4QnBfuDiKAucNNv2eBKH2bks1h0g6EJlgBYNb57+3VDN0HsHRlduH XtiLZldGkV3gEfmaINKHMGDf8pP5ntq+vNgFfm0oYV8fRT3a+RUR/7iVFbZ1rZ9xV6Tc HIY8ZksepYad+fgRTlvf8uY8x4PzeYqsJTsgXUN8jZFdHElsvpKRl8mOxuEwqg91oehA YZp/2lvMQitnuwZ+H9YRi5rrbfg6RhmIqSLgUMxojAcO3qz1PkPqK0hpWXZyPuf7xYJ/ 7uXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si6622815eja.141.2021.01.25.22.36.47; Mon, 25 Jan 2021 22:37:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729290AbhAZGcp (ORCPT + 99 others); Tue, 26 Jan 2021 01:32:45 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11494 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbhAYOLy (ORCPT ); Mon, 25 Jan 2021 09:11:54 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DPWvr3VkzzjD03; Mon, 25 Jan 2021 22:09:44 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Mon, 25 Jan 2021 22:10:46 +0800 From: Yanan Wang To: Marc Zyngier , Will Deacon , "Catalin Marinas" , James Morse , "Julien Thierry" , Suzuki K Poulose , , , , CC: , , Yanan Wang Subject: [PATCH 0/2] Performance improvement about cache flush Date: Mon, 25 Jan 2021 22:10:42 +0800 Message-ID: <20210125141044.380156-1-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.128] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This two patches are posted to introduce a new method that can distinguish cases of allocating memcache more precisely, and to elide some unnecessary cache flush. For patch-1: With a guest translation fault, we don't really need the memcache pages when only installing a new entry to the existing page table or replacing the table entry with a block entry. And with a guest permission fault, we also don't need the memcache pages for a write_fault in dirty-logging time if VMs are not configured with huge mappings. So a new method is introduced to distinguish cases of allocating memcache more precisely. For patch-2: If migration of a VM with hugepages is canceled midway, KVM will adjust the stage-2 table mappings back to block mappings. With multiple vCPUs accessing guest pages within the same 1G range, there could be numbers of translation faults to handle, and KVM will uniformly flush data cache for 1G range before handling the faults. As it will cost a long time to flush the data cache for 1G range of memory(130ms on Kunpeng 920 servers, for example), the consequent cache flush for each translation fault will finally lead to vCPU stuck for seconds or even a soft lockup. I have met both the stuck and soft lockup on Kunpeng servers with FWB not supported. When KVM need to recover the table mappings back to block mappings, as we only replace the existing page tables with a block entry and the cacheability has not been changed, the cache maintenance opreations can be skipped. Yanan Wang (2): KVM: arm64: Distinguish cases of allocating memcache more precisely KVM: arm64: Skip the cache flush when coalescing tables into a block arch/arm64/kvm/mmu.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) -- 2.19.1