Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1554695ybg; Tue, 2 Jun 2020 13:14:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHvkzpF7StFr8iLaeU+EJIdbStwk3z7rkHHtup9t04pN4R/dXWS7zAT/bhGMt8LFiJcnyk X-Received: by 2002:a50:8707:: with SMTP id i7mr27545684edb.180.1591128839974; Tue, 02 Jun 2020 13:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591128839; cv=none; d=google.com; s=arc-20160816; b=vkfobIAus9GhK9v+BUKc4uADx8PqR1hFXFf/PgFb/vIyFU/d7y247PSiw8inuCLOBz xj8yhc8KfTpZ0The2px60lDT1Foy/ov5YW6H5Urk2S1awsFAS85PNWBziihGq4zH0MPd 6sQe5SkKqKNRrUd8iFwgqi/+vbSche3HpLHk0g9QCq+KpgMHW4lj8Ol0hQG58tugWmcr THRKL5OpKXhPpN66VivGWd3bYyNemuPw90m13LeAbGRP3ddxI4HHwpJhBF9siYohiGTW +rQ/rO8KozTczfXBtWnaeYDU7deHstMeb9RaIEwB4hnoc2jxNKqdG2lTeRBWg0u/Z5G9 obGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=Zy+9hIUOD1wHoEjv0iqcOdN6XDgnng/gMIII196nKXk=; b=GsXAJ6VJ67PtkkqmkRbxlJxif2Uo2u0y8ZPBmcf3OJy+0Gjq1IMbJaYdFUN6EqO0cN pnoI1/pNG0A8gPKw81Lpse9WhcMQuw1GJxIA02qHl8xtu1nlLhtPP856xuMdU0CVHf9h 7QawhG9afdjB0a8/Zprmg5Wr+3vcMQlF9izwHA7AFtr46ObQGgFrh7On58QcJsnfTcZo pQ+tYqjxLXEz3Bx3A+Lol063//zvZTC5hkVH+IJ73Xs3ldxTouUqwjuKKJARDgEoMlbY uvUmKPCqEmQ6yWulQoRorK0kLSPvsm6YR+RzsUq5+mUncarxtqRD+f+DzUSlcsUD/z4P nKnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=z+tGXNWX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si2032789edv.71.2020.06.02.13.13.36; Tue, 02 Jun 2020 13:13:59 -0700 (PDT) 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; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=z+tGXNWX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728380AbgFBUKs (ORCPT + 99 others); Tue, 2 Jun 2020 16:10:48 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:53716 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728101AbgFBUKr (ORCPT ); Tue, 2 Jun 2020 16:10:47 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 052JvxMj163024; Tue, 2 Jun 2020 20:09:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2020-01-29; bh=Zy+9hIUOD1wHoEjv0iqcOdN6XDgnng/gMIII196nKXk=; b=z+tGXNWXcpe4kITTBT32god173s9pokQEK6VzOFsdQ3siX5keWyR1QMHN2W70Ff8C+B+ rxDToZRd+1zqTyC8u7HAggP6i0MWWS1eFES8BEs89ChlGn/sNu3YsWQNVQEBTjR3B12M 42Cd8MmRWKocBTsEMS+W6DVOgSBuLlazO9u2LU9tXUA6uFuUodnU44Z/MNnxnPJJG7IC F8Nc/DsSHdVA7XEEGea7sxqM8frdxX6LX63nW5EX5tCDlwm6Sv3WFfVwc/8E5sJevIzi lV7fVZAsi9s3tlf7LNo/knOZz3+7H2bV0+pbbyAUJ6+zgfC+Lb9XkwWxVW5OOkteWklk jw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 31bewqwyhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 02 Jun 2020 20:09:41 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 052JxIK9135342; Tue, 2 Jun 2020 20:07:41 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 31c1dxtrmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Jun 2020 20:07:41 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 052K7b5o013919; Tue, 2 Jun 2020 20:07:37 GMT Received: from ayz-linux.us.oracle.com (/10.154.185.88) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Jun 2020 13:07:36 -0700 From: Anthony Yznaga To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, steven.sistare@oracle.com, anthony.yznaga@oracle.com Subject: [PATCH 0/3] avoid unnecessary memslot rmap walks Date: Tue, 2 Jun 2020 13:07:27 -0700 Message-Id: <1591128450-11977-1-git-send-email-anthony.yznaga@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9640 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020146 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9640 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 bulkscore=0 phishscore=0 suspectscore=0 impostorscore=0 cotscore=-2147483648 lowpriorityscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020146 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While investigating optimizing qemu start time for large memory guests I found that kvm_mmu_slot_apply_flags() is walking rmaps to update existing sptes when creating or moving a slot but that there won't be any existing sptes to update and any sptes inserted once the new memslot is visible won't need updating. I can't find any reason for this not to be the case, but I've taken a more cautious approach to fixing this by dividing things into three patches. Anthony Yznaga (3): KVM: x86: remove unnecessary rmap walk of read-only memslots KVM: x86: avoid unnecessary rmap walks when creating/moving slots KVM: x86: minor code refactor and comments fixup around dirty logging arch/x86/kvm/x86.c | 106 +++++++++++++++++++++++++---------------------------- 1 file changed, 49 insertions(+), 57 deletions(-) -- 2.13.3