From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C08CC4338F for ; Fri, 6 Aug 2021 11:33:12 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A8C8560FE7 for ; Fri, 6 Aug 2021 11:33:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A8C8560FE7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From: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=0zwV0snshR/uBlz3GLrwvtqzD393NBHkvBXIyo3iSpg=; b=0FWpfCPJrtZUSE Dum7Mgycw6qh6EvrZMpJZ6I8V6yA1R9XcJtOaVzNXl1Aqo186VNL3AlB5Y+yYfn1C4GlJR3i601Pm QvxA/DLRCAkhSKmQuIHJ0MZnjfH8eQlxvIoleeg6KA/KH4foK0opyg8ddg2fz6guXcIcZetuQIgYc rvQGY6vz9F7RY7hwlRCkQykeQs+wJyX8qU81G9yO2dU3j/m8VCvBjpYPQ1gUqZcS1wjfmmYp/PExw 7TaBm6E/6ov6w0XgFDg+46GwroEKfcnNTcTsVVaUnrCDQj2J0mXYjE2VMs66I5puGKcJBlDwXGff1 ZGGgRutNkYZi4itGOW3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBy4T-00CHmP-HW; Fri, 06 Aug 2021 11:31:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mBy4Q-00CHlC-1e for linux-arm-kernel@lists.infradead.org; Fri, 06 Aug 2021 11:31:23 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E1A860F38; Fri, 6 Aug 2021 11:31:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628249481; bh=Wve2HPDAh8pk0/x/LBGSqB32H47g9ounsHsBh1cD85Q=; h=From:To:Cc:Subject:Date:From; b=itbTs6Chs219vUx56bnuoMQodGO4uXYcJwmWzsgssM61sEDB7ZFelV1dnBvkQFn7Y IVX2ZYpMk8T2zdk2vGtcS/+/qSIaPoBJZhTyx5JeL8XSqdkj/ZxDYREl3nFmhwWsyC ZvsU36kKfmQeMFEtMaMDT0Io54hinjIlXotpHos6Jz1jShYNEO+ev67DGDi1J6ZYX3 m8W8jzl/fuc67aVhVuIFmEPMswS5BKfGQ/tBQP4fPjSDVEdW5NZKucr23BtMR1tPiw ALnTb5U4n7XatGDlV/aZPktQRKBKFUOib4ravqnOtRt+r7lmCIPTm8WbvCyANhzhgm Hp9sZNXBJVBWA== From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: kernel-team@android.com, Will Deacon , Catalin Marinas , Marc Zyngier , Jade Alglave , Shameer Kolothum , kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org Subject: [PATCH 0/4] Fix racing TLBI with ASID/VMID reallocation Date: Fri, 6 Aug 2021 12:31:03 +0100 Message-Id: <20210806113109.2475-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210806_043122_146573_8A655638 X-CRM114-Status: UNSURE ( 8.27 ) X-CRM114-Notice: Please train this message. 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, While reviewing Shameer's reworked VMID allocator [1] and discussing with Marc, we spotted a race between TLB invalidation (which typically takes an ASID or VMID argument) and reallocation of ASID/VMID for the context being targetted. The first patch spells out an example with try_to_unmap_one() in a comment, which Catalin has kindly modelled in TLA+ at [2]. Although I'm posting all this together for ease of review, the intention is that the first patch will go via arm64 with the latter going via kvm. Cheers, Will [1] https://lore.kernel.org/r/20210729104009.382-1-shameerali.kolothum.thodi@huawei.com [2] https://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/kernel-tla.git/commit/ Cc: Catalin Marinas Cc: Marc Zyngier Cc: Jade Alglave Cc: Shameer Kolothum Cc: Cc: --->8 Marc Zyngier (3): KVM: arm64: Move kern_hyp_va() usage in __load_guest_stage2() into the callers KVM: arm64: Convert the host S2 over to __load_guest_stage2() KVM: arm64: Upgrade VMID accesses to {READ,WRITE}_ONCE Will Deacon (1): arm64: mm: Fix TLBI vs ASID rollover arch/arm64/include/asm/kvm_mmu.h | 17 ++++++----- arch/arm64/include/asm/mmu.h | 29 ++++++++++++++++--- arch/arm64/include/asm/tlbflush.h | 11 +++---- arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 2 +- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 6 ++-- arch/arm64/kvm/hyp/nvhe/switch.c | 4 ++- arch/arm64/kvm/hyp/nvhe/tlb.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/tlb.c | 2 +- arch/arm64/kvm/mmu.c | 2 +- 11 files changed, 52 insertions(+), 27 deletions(-) -- 2.32.0.605.g8dce9f2422-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel