From patchwork Fri Jun 2 17:01:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colton Lewis X-Patchwork-Id: 13265715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 724C0C7EE29 for ; Fri, 2 Jun 2023 17:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XmQ1JZ32H6ZD+WkzyUGL7zOaQ44rENRPXuB5CRWs24k=; b=s5m zFYWm6aeva0LVkpd9ItHPkAOg9/rbhu/QRysC6sP7f4t/r/rguzzg/b3/tMY13hYjUYhi9lMyuq5P IPQs7FsrEWl1bDIRjbyEgNRJZUSEREm0vLqozYiRnXhx5aUJQMmBjsBF4RFWuNq8t8YTzHUfmPXeq WbzCYBNo5cZeeRoxvlRwnz4FLALMNJEwbnaJsml45tZM5oXaR6FhFP5Cy5Gubd6LQ43NJ9UMCAlT9 BemvZ3mUqeUxueAelEBf/c/VtHH3YrjaL2/1p0LL0dJsbHFCbmsjuA5XCfB8xF3P2TPhZuopmPI4s RL5m8ftbz6gbwJ+BenMtzPq1TpHzK6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q58Ax-007UKR-38; Fri, 02 Jun 2023 17:02:55 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q58Av-007UIz-2g for linux-arm-kernel@lists.infradead.org; Fri, 02 Jun 2023 17:02:55 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-ba82ed6e450so3011126276.2 for ; Fri, 02 Jun 2023 10:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685725370; x=1688317370; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=yIiKOLGKczROWKwulUVtZ2M9/BiqL1vWmyT9WxaSM60=; b=pgEp6VvqA7aBhrJuKZzQ4zBVM03oPZHiD+4ylV7AFMyKOKMZY+kiaxDz5l0Ypk+iO2 MUF7c2eCaBHPpjtDiRh4GgjpTtJsKr/1ezP7uIgCNumlJZWWgEbgxSkLBGDTITBINiP0 h/+lY9p5RUWI1mm3RgI0TT6fMDQdeLaT406FqAvUvjluat/s5sl9h9AAkK/1H2Hx1sPb TIkOmqDFjvVeSWe6Fnaup3uBKk9/wxZeRRXAEAdCIgNMknlLeaSgWKp6DPYDAKTDliwK r7EIWTuWCPHj9hwA5oafkO5VzVh8JjN1pTIPxJYZHGvkqCYUIOhocoXxB+jqaTvCi1vw DqAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685725370; x=1688317370; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yIiKOLGKczROWKwulUVtZ2M9/BiqL1vWmyT9WxaSM60=; b=QFr7ciYwhOpn5x+0nYo6SfM7WbL5vKLZvCarhl8K5qaaJVxpdaST+lMtl4xn/+WySd 41fRAlk97rKnMNFb9AQBGfu6Ukitf051c8EsO9NCaUxX0INYVGlBI4dxtLwn+p75/iwg NTMxb8I/6dBtv6xlGy++4lPChnmrMqJJyLFwFuVwfdp67T8Gky9lPwyWUIjOJ/4+jIip d9YaHvo9prBbKiZO6gqMtk7Wpap66y75jW0rUE+uqH8Pu9T7bUBNIT7ZY4b69jrhGJ7H X8ST0LA7ziAgEGPx5mnl8o78Y6/NnWLHJVRhYDR70gOxBqPrhy1nTIydsjnj7kZ2M93y zn5Q== X-Gm-Message-State: AC+VfDzWDnZ0MjwWoTdLBSRr7b0MkTN3SP4gXvujjEwHyOsG3pksRb3y pVpwTQBzkmKdCsoP5sUulJ44XxwalACTIXvYYQ== X-Google-Smtp-Source: ACHHUZ6Vu7NrmZDIrdvPM8A+x+HDDvlXsWN3Wbj3yjrPjyPq4Je9swBQszqmoLNylUJ2YOeY/0U1p8/9fWz27M9x5g== X-Received: from coltonlewis-kvm.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:14ce]) (user=coltonlewis job=sendgmr) by 2002:a05:6902:114b:b0:bad:89:29d5 with SMTP id p11-20020a056902114b00b00bad008929d5mr1364181ybu.2.1685725370603; Fri, 02 Jun 2023 10:02:50 -0700 (PDT) Date: Fri, 2 Jun 2023 17:01:44 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230602170147.1541355-1-coltonlewis@google.com> Subject: [PATCH 0/3] Relax break-before-make use with FEAT_BBM From: Colton Lewis To: kvm@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Colton Lewis X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230602_100253_867993_C68509FF X-CRM114-Status: GOOD ( 11.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently KVM follows the lengthy break-before-make process every time the page size changes, which requires KVM to do a broadcast TLB invalidation and data serialization for every affected page table entry. This is expensive. FEAT_BBM Level 2 support precludes the need to follow the whole process when page size is the only thing that changed. This series detects said support and avoids the unnecessary expensive operations, speeding up the execution of the stage2 page table walkers. Considerable time and effort has been spent trying to measure the performance benefit, mainly using dirty_log_perf_test with huge pages, but nothing was seen that stood out from ordinary variation between runs. This is puzzling, but getting the series reviewed anyway may spark some ideas. This is based on kvmarm-6.4 + Ricardo's eager page splitting series [1] to cover the eager splitting case as well. Similar changes were originally part of that series but it was suggested FEAT_BBM should be its own series. [1] https://lore.kernel.org/kvmarm/20230426172330.1439644-1-ricarkol@google.com/ Colton Lewis (2): KVM: arm64: Clear possible conflict aborts KVM: arm64: Skip break phase when we have FEAT_BBM level 2 Ricardo Koller (1): arm64: Add a capability for FEAT_BBM level 2 arch/arm64/include/asm/esr.h | 1 + arch/arm64/kernel/cpufeature.c | 11 +++++++ arch/arm64/kvm/hyp/pgtable.c | 58 ++++++++++++++++++++++++++++++---- arch/arm64/kvm/mmu.c | 6 ++++ arch/arm64/tools/cpucaps | 1 + 5 files changed, 70 insertions(+), 7 deletions(-) --- 2.41.0.rc0.172.g3f132b7071-goog