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 Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC644C4332F for ; Tue, 1 Nov 2022 20:22:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 510F14BABE; Tue, 1 Nov 2022 16:22:23 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XFI5o6-zA5LY; Tue, 1 Nov 2022 16:22:22 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3AD444BA8C; Tue, 1 Nov 2022 16:22:22 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 438664BA8C for ; Tue, 1 Nov 2022 16:22:21 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0-5UC3YCBzS for ; Tue, 1 Nov 2022 16:22:20 -0400 (EDT) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 0C5B14BA1C for ; Tue, 1 Nov 2022 16:22:19 -0400 (EDT) Received: by mail-pf1-f180.google.com with SMTP id v28so14320567pfi.12 for ; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=M4X/osJ6VqZpKNtuP99fp4hNhqecoTugRL5QfWaIhyUxA9c53vT2gzUsKKGIv4cq+D N4IonfyyypScYrsv8ODBCuTAKMU/o3MuedyC4XY7mQxji9pS70V0SKgDvwYFSfWhghQ5 DSHIteFpQ5DT8H/yuhvbuDJ+aT14g2LOoyFC7UtDqZDOCQSYZGT07KnHz1DlHeril/bj KZ6lYlB1F8nR11PVom9zZllOxYKCdv33fJC9+NNvtrvNHgsPRLMmiaeyoIMyvL0/2rzw cm6ucLucJ1hX/EB3aXe+tUxGs+j1hQ/M65oNHUJ7CRlwtvLEnlMzSzEVZREE3HFHamlW wBrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=PLofyllPSkeAYngW9NEphs5IcvE/eGEfvAVWY6IRcGtusMo7WnkKaj7TpJthzgZNnA 0zmdhJFyZfOayZNCYHJeVtIpIw+RGTn5kty6P2gJmb1xpQHaU6ZK+Xg+xffb3RFOeMZO nSYupg36NPKQtehwa/79ETr5F1pXrj4zl+39QOpAAauJ3Ya+nzgtAHv3xaTIPNG/qFns S7t0puFHrWVy+m5aeoMlc1cGO4mkZSWsSDoCwsPpQsByaLkKIdXy52TJN5porQhIvKvH Y8GeUxD99aNOpH832uJ9467eOn4NoJ2qfL1ATZoLrUfLzPpiSij5UdYrH8JO7l+dDIxt 828w== X-Gm-Message-State: ACrzQf3qjQug3NIulHpJUj5r/WQgtx9pwUXwPboZTG8zQF0uo92Sp2AH 5yKbsM5a0mcrlqInjN5Y9wsBpQ== X-Google-Smtp-Source: AMsMyM7fD/Ym5AIcfwQwPvEeDSThfT/5hUO484wIK3KagW5eWCNhPeqPpcfATaT8FOx4g4d/EWqTBw== X-Received: by 2002:a05:6a00:2481:b0:56b:dc84:7ad1 with SMTP id c1-20020a056a00248100b0056bdc847ad1mr21687157pfv.43.1667334139000; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id x5-20020a170902ec8500b00187022627d8sm6816709plg.62.2022.11.01.13.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 13:22:18 -0700 (PDT) Date: Tue, 1 Nov 2022 20:22:15 +0000 From: Sean Christopherson To: Oliver Upton Subject: Re: [PATCH v3 08/15] KVM: arm64: Protect stage-2 traversal with RCU Message-ID: References: <20221027221752.1683510-1-oliver.upton@linux.dev> <20221027221752.1683510-9-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221027221752.1683510-9-oliver.upton@linux.dev> Cc: kvm@vger.kernel.org, Marc Zyngier , Will Deacon , kvmarm@lists.linux.dev, Ben Gardon , David Matlack , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thu, Oct 27, 2022, Oliver Upton wrote: > The use of RCU is necessary to safely change the stage-2 page tables in > parallel. RCU isn't strictly necessary, it's simply _a_ way to ensure readers have gone away prior to freeing memory. E.g. another method (used on x86 at least), is to disable IRQs when walking page tables without holding mmu_lock, and then requiring paths that free page tables to effectively do an IPI shootdown of all CPUs that are reading page tables. And "safely change" is misleading. RCU doesn't allow safely _changing_ page tables; if RCU did, then patch 10 wouldn't need to implement atomic updates. Protecting page table walks with RCU is purely about ensuring readers have gone away prior to freeing the backing memory, an entirely different mechanism is needed to allow parallel updates, e.g. the CMPXCHG + KVM_INVALID_PTE_LOCKED approach to ensure only one walker "owns" the detached page table. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACF317E for ; Tue, 1 Nov 2022 20:22:19 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id m6so14538192pfb.0 for ; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=M4X/osJ6VqZpKNtuP99fp4hNhqecoTugRL5QfWaIhyUxA9c53vT2gzUsKKGIv4cq+D N4IonfyyypScYrsv8ODBCuTAKMU/o3MuedyC4XY7mQxji9pS70V0SKgDvwYFSfWhghQ5 DSHIteFpQ5DT8H/yuhvbuDJ+aT14g2LOoyFC7UtDqZDOCQSYZGT07KnHz1DlHeril/bj KZ6lYlB1F8nR11PVom9zZllOxYKCdv33fJC9+NNvtrvNHgsPRLMmiaeyoIMyvL0/2rzw cm6ucLucJ1hX/EB3aXe+tUxGs+j1hQ/M65oNHUJ7CRlwtvLEnlMzSzEVZREE3HFHamlW wBrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=h9xYBsH/qDrVDsWZ030b5lmUeiqyU0HdEjI5x3OuGxghndwtJUgTKcnHw6N+bWVXZ/ mrk7IVSBaKifWk8NRhAWRTRIiWgTTCCt1veSh5Ku5X7K5lvHerfnl4eXyDWAL5QU1Tof vhBN10fLBkZPjASLdCE9X8XV62RRjn8lFlQstaGm+tbYrd8qaXyIgt6Mlvtee1doPRxi 9Oj1npdwLi+ZjpFfebEGuyuhuejArT7MvtaT2z+hyGJ2cxi8h7BsuyeT2rmAEPPF/GN5 aZoHfb7Jlmh53YvzXYbWceUllDPNRiQzB9mzslhAocT5PMjPxJX6xMD+yQvXKM8QDxFA acRg== X-Gm-Message-State: ACrzQf0XO56vR3mWLYm6Kg7p4K4rnfuKqEITNPeC2rwvO69m/7YYdwXi 6HlaIptpglGy1c+aOl1gRvt8vg== X-Google-Smtp-Source: AMsMyM7fD/Ym5AIcfwQwPvEeDSThfT/5hUO484wIK3KagW5eWCNhPeqPpcfATaT8FOx4g4d/EWqTBw== X-Received: by 2002:a05:6a00:2481:b0:56b:dc84:7ad1 with SMTP id c1-20020a056a00248100b0056bdc847ad1mr21687157pfv.43.1667334139000; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id x5-20020a170902ec8500b00187022627d8sm6816709plg.62.2022.11.01.13.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 13:22:18 -0700 (PDT) Date: Tue, 1 Nov 2022 20:22:15 +0000 From: Sean Christopherson To: Oliver Upton Cc: Marc Zyngier , James Morse , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Reiji Watanabe , Ricardo Koller , David Matlack , Quentin Perret , Ben Gardon , Gavin Shan , Peter Xu , Will Deacon , kvmarm@lists.linux.dev Subject: Re: [PATCH v3 08/15] KVM: arm64: Protect stage-2 traversal with RCU Message-ID: References: <20221027221752.1683510-1-oliver.upton@linux.dev> <20221027221752.1683510-9-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221027221752.1683510-9-oliver.upton@linux.dev> Message-ID: <20221101202215.P7GcqTfm7tnAXno1ukGnUBwPL8nc_rqPhg6WzvkQXjU@z> On Thu, Oct 27, 2022, Oliver Upton wrote: > The use of RCU is necessary to safely change the stage-2 page tables in > parallel. RCU isn't strictly necessary, it's simply _a_ way to ensure readers have gone away prior to freeing memory. E.g. another method (used on x86 at least), is to disable IRQs when walking page tables without holding mmu_lock, and then requiring paths that free page tables to effectively do an IPI shootdown of all CPUs that are reading page tables. And "safely change" is misleading. RCU doesn't allow safely _changing_ page tables; if RCU did, then patch 10 wouldn't need to implement atomic updates. Protecting page table walks with RCU is purely about ensuring readers have gone away prior to freeing the backing memory, an entirely different mechanism is needed to allow parallel updates, e.g. the CMPXCHG + KVM_INVALID_PTE_LOCKED approach to ensure only one walker "owns" the detached page table. 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 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 408DBC433FE for ; Tue, 1 Nov 2022 20:23:28 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bvkDm2b9FVWkZ4gU3p4lPxR0dMn9omcly/9pAZYd/9g=; b=tcyQ1/ZplK+kfe aJO+ozhEw/I7uXdsSdOq5BYUpvBMrZKv+OeKEL9MYPwtufiqw4rf2dhrXdVmkzyeXqGTzznMYw7X9 76f2Fc0ULayC+mEHH5cMv9HEZOLf9rNnXYPgGkjjzbaEra/q0w6mOlAajf3ZGTGJ7Bqd6p1nL/MvA jUOqUZ5tTurL7C0KBR/qsw9qZ2oak7hfGC4GbZgk9q/zoQoPLIGFa43YaSxU8H+HBKaikf4llm+sD xmGBE8JMvZ8xADgjCuMkRryEmrVltz3dUifQBbv8d9y5BNqiwkAAL9Nrh3NR0r/ydXhrwgCZF0Se9 LBDZBymZ3WYv40c2Widw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opxmB-006tv4-Kn; Tue, 01 Nov 2022 20:22:23 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opxm8-006tuO-7U for linux-arm-kernel@lists.infradead.org; Tue, 01 Nov 2022 20:22:21 +0000 Received: by mail-pf1-x433.google.com with SMTP id b185so14495016pfb.9 for ; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=M4X/osJ6VqZpKNtuP99fp4hNhqecoTugRL5QfWaIhyUxA9c53vT2gzUsKKGIv4cq+D N4IonfyyypScYrsv8ODBCuTAKMU/o3MuedyC4XY7mQxji9pS70V0SKgDvwYFSfWhghQ5 DSHIteFpQ5DT8H/yuhvbuDJ+aT14g2LOoyFC7UtDqZDOCQSYZGT07KnHz1DlHeril/bj KZ6lYlB1F8nR11PVom9zZllOxYKCdv33fJC9+NNvtrvNHgsPRLMmiaeyoIMyvL0/2rzw cm6ucLucJ1hX/EB3aXe+tUxGs+j1hQ/M65oNHUJ7CRlwtvLEnlMzSzEVZREE3HFHamlW wBrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xVkJZtEBpIeuzqQn3nnjuzEWSUM1mVqhj+nnH0c1tQc=; b=J4jJUdjhEhoTWnpykZSwo9CmuUHama2R0rcP/VZ8IMgGzSxkXUTICIbr+1RxPnvqNi WBELUW4fjuokg3GRtEQLo4SVMaMfWoZVYBOKddgQaS8D/IpYpMRjGN2v35y+qImUaxco kUdRphMG0tRREA4uve4osswCkHcYg1sInfJO0naqVK1gfeni0++vjRmBhT1HchOvykqy j7R/ujfPECFTkLFls0dM00oqV1fBeud3H/duNTzQC7szfh7OXJ6SQu3TIDo2rOQx7rA8 Lx49HWW3Zmu4uVtWlydiLiDY8coIoE5Ie4RxiGBGootAESHbxE6IWgMp7e5kWbb5nsTh Xw4w== X-Gm-Message-State: ACrzQf3idPcAH78xGDzyLRu4cuV1IEmCDOB6qcVPs71nKGsREIIdEDil K957wIyhYTFX72BsTcOdPXaaUA== X-Google-Smtp-Source: AMsMyM7fD/Ym5AIcfwQwPvEeDSThfT/5hUO484wIK3KagW5eWCNhPeqPpcfATaT8FOx4g4d/EWqTBw== X-Received: by 2002:a05:6a00:2481:b0:56b:dc84:7ad1 with SMTP id c1-20020a056a00248100b0056bdc847ad1mr21687157pfv.43.1667334139000; Tue, 01 Nov 2022 13:22:19 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id x5-20020a170902ec8500b00187022627d8sm6816709plg.62.2022.11.01.13.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 13:22:18 -0700 (PDT) Date: Tue, 1 Nov 2022 20:22:15 +0000 From: Sean Christopherson To: Oliver Upton Cc: Marc Zyngier , James Morse , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Reiji Watanabe , Ricardo Koller , David Matlack , Quentin Perret , Ben Gardon , Gavin Shan , Peter Xu , Will Deacon , kvmarm@lists.linux.dev Subject: Re: [PATCH v3 08/15] KVM: arm64: Protect stage-2 traversal with RCU Message-ID: References: <20221027221752.1683510-1-oliver.upton@linux.dev> <20221027221752.1683510-9-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221027221752.1683510-9-oliver.upton@linux.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221101_132220_288752_5FFD0FD7 X-CRM114-Status: GOOD ( 10.82 ) 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 On Thu, Oct 27, 2022, Oliver Upton wrote: > The use of RCU is necessary to safely change the stage-2 page tables in > parallel. RCU isn't strictly necessary, it's simply _a_ way to ensure readers have gone away prior to freeing memory. E.g. another method (used on x86 at least), is to disable IRQs when walking page tables without holding mmu_lock, and then requiring paths that free page tables to effectively do an IPI shootdown of all CPUs that are reading page tables. And "safely change" is misleading. RCU doesn't allow safely _changing_ page tables; if RCU did, then patch 10 wouldn't need to implement atomic updates. Protecting page table walks with RCU is purely about ensuring readers have gone away prior to freeing the backing memory, an entirely different mechanism is needed to allow parallel updates, e.g. the CMPXCHG + KVM_INVALID_PTE_LOCKED approach to ensure only one walker "owns" the detached page table. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel