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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=no 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 DCACBC47096 for ; Tue, 1 Jun 2021 13:31:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF0E613C1 for ; Tue, 1 Jun 2021 13:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234052AbhFANcz (ORCPT ); Tue, 1 Jun 2021 09:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233925AbhFANcx (ORCPT ); Tue, 1 Jun 2021 09:32:53 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4CDC061574 for ; Tue, 1 Jun 2021 06:31:11 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id c3so14320670wrp.8 for ; Tue, 01 Jun 2021 06:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=LP2fsEvMTFs8wSLGgZY1ubi1BD83fbQR+WWGlnKbnhrJzkcoYhZUlw/ZkFPHVRX2pS 1kxI8JgLhb0g3kz0pGI8o3ABqCJYAa0imQmWdnz1EWZGapSxVVG0FE8I2m7eCNFp+FhJ LX0uC4VCrnahVcOZ/Fet/aQm0qdopbZL6zqs2RlZqUjc4xKX7utUPhIEuwzdWLNG7IVz ++liR5Sn4WQaIdIQG2oJDi6hnggLc2WP6sfG4+RcODkWpixbjWvXjXfdGBeUfjYhoY1y DhzTNVl41otb4rKKFkL85f8end5tGK+CpDfjGjCeZ4NEEnEvWdsyM8i67qe/y/1t0Wyt kmQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=M6opWu46tPQcqu3EBtNFcE6BfBHC/TV1SVzTWGRBBBP2cxcw2VCnBiWBzCoEdKEmGi AHw98JQiURbs9KMQPg0zPnDqpACMPi+G1fGXwu2Bb9sPgF68k1KXNKddFdqvHLz5tmWr sZ96iQfORVH6NX3PeifY7piMKfZ/YNjbNxMWYaysP5dAw/bocKY3R97d5XT8bnHS7pxk xLu9zGlW0l/1UvVdJBzr6iHUw+m0ApZIkBWbf6RB+U5RwgQOmFJ7N/CyboV++SCBTRRQ QvlTzyRiSGGvlAoVtJt0oCHxbri3V/7T/+ngTFpIoioBIn8etCb7pM95FZt/BdnT6dlE 0raQ== X-Gm-Message-State: AOAM530GAAXc1/fg/fUanIqeM1mJQjH8XvhjoWAexqiN41/Doovopx+c bCPIJ2SDPUeV2wTLQ1iotR5B3w== X-Google-Smtp-Source: ABdhPJwkD2HduO0uUirxMSgy26JktuDamd44LHDyKx90TnuHOIIZTT9Fv/kzeN7mfG9dVVkN7NVWOg== X-Received: by 2002:a5d:4003:: with SMTP id n3mr27693980wrp.173.1622554270083; Tue, 01 Jun 2021 06:31:10 -0700 (PDT) Received: from google.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id w13sm490487wmi.4.2021.06.01.06.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 06:31:09 -0700 (PDT) Date: Tue, 1 Jun 2021 13:31:06 +0000 From: Quentin Perret To: Marc Zyngier Cc: will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, catalin.marinas@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] KVM: arm64: Move hyp_pool locking out of refcount helpers Message-ID: References: <20210527125134.2116404-1-qperret@google.com> <20210527125134.2116404-2-qperret@google.com> <87sg2123pj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sg2123pj.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 01 Jun 2021 at 13:02:00 (+0100), Marc Zyngier wrote: > On Thu, 27 May 2021 13:51:28 +0100, > Quentin Perret wrote: > > > > The hyp_page refcount helpers currently rely on the hyp_pool lock for > > serialization. However, this means the refcounts can't be changed from > > the buddy allocator core as it already holds the lock, which means pages > > have to go through odd transient states. > > > > For example, when a page is freed, its refcount is set to 0, and the > > lock is transiently released before the page can be attached to a free > > list in the buddy tree. This is currently harmless as the allocator > > checks the list node of each page to see if it is available for > > allocation or not, but it means the page refcount can't be trusted to > > represent the state of the page even if the pool lock is held. > > > > In order to fix this, remove the pool locking from the refcount helpers, > > and move all the logic to the buddy allocator. This will simplify the > > removal of the list node from struct hyp_page in a later patch. > > Is there any chance some documentation could be added so that we have > a record of what the locking boundaries are? Something along the line > of what we have in arch/arm64/kvm/vgic/vgic.c, for example. Sounds like a good idea, I'll go write something. Cheers, Quentin 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=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE autolearn=no 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 D9DDCC47093 for ; Tue, 1 Jun 2021 13:31:15 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 51E3F613CB for ; Tue, 1 Jun 2021 13:31:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51E3F613CB Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E2CE049FB0; Tue, 1 Jun 2021 09:31:14 -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 tgeAeqo0UbnT; Tue, 1 Jun 2021 09:31:13 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E202B49E93; Tue, 1 Jun 2021 09:31:13 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B62C149E5F for ; Tue, 1 Jun 2021 09:31:12 -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 EMhh+QfMbwaf for ; Tue, 1 Jun 2021 09:31:11 -0400 (EDT) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 73B0C49E57 for ; Tue, 1 Jun 2021 09:31:11 -0400 (EDT) Received: by mail-wr1-f43.google.com with SMTP id q5so14340358wrs.4 for ; Tue, 01 Jun 2021 06:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=LP2fsEvMTFs8wSLGgZY1ubi1BD83fbQR+WWGlnKbnhrJzkcoYhZUlw/ZkFPHVRX2pS 1kxI8JgLhb0g3kz0pGI8o3ABqCJYAa0imQmWdnz1EWZGapSxVVG0FE8I2m7eCNFp+FhJ LX0uC4VCrnahVcOZ/Fet/aQm0qdopbZL6zqs2RlZqUjc4xKX7utUPhIEuwzdWLNG7IVz ++liR5Sn4WQaIdIQG2oJDi6hnggLc2WP6sfG4+RcODkWpixbjWvXjXfdGBeUfjYhoY1y DhzTNVl41otb4rKKFkL85f8end5tGK+CpDfjGjCeZ4NEEnEvWdsyM8i67qe/y/1t0Wyt kmQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=AlDSbaVEaxiVAzOFxU1TBG27P0ZD9V6J93cNgj1w+6oXC541SYrDFHR+3f1Yqrlqpb o+r4sbHH0lyxzvmduLAALGm/q5UarORpIXDKrQvTx6g1AWWkxefiLQ7iNCoceqifSMUJ NvOekVw5LjAne8jVWsi9ebVC3WeBgdey/+K9aoAsahvxECTU7P9K/TQBx1pwVl+jMQdJ sVwjSFVCdMHtDe8Y0UvYUlOFqakg07kxBoLOfYUS7xJ7u8LrZilvyNmhz8rwliiWSTFP C9ClU1rQqkVBtQCglMp/YeW6P63UTggtHfNe+BH6B0XGLy9tged+DZ2DFCk+4k/kGEQC OocA== X-Gm-Message-State: AOAM53144c2fpHydqfnnT2M2FmJyRVty9u1xOMLkRV9YcrE7zCd3+bGa EhMS/MIJtPRVqmKxvdDeE7aUEA== X-Google-Smtp-Source: ABdhPJwkD2HduO0uUirxMSgy26JktuDamd44LHDyKx90TnuHOIIZTT9Fv/kzeN7mfG9dVVkN7NVWOg== X-Received: by 2002:a5d:4003:: with SMTP id n3mr27693980wrp.173.1622554270083; Tue, 01 Jun 2021 06:31:10 -0700 (PDT) Received: from google.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id w13sm490487wmi.4.2021.06.01.06.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 06:31:09 -0700 (PDT) Date: Tue, 1 Jun 2021 13:31:06 +0000 From: Quentin Perret To: Marc Zyngier Subject: Re: [PATCH 1/7] KVM: arm64: Move hyp_pool locking out of refcount helpers Message-ID: References: <20210527125134.2116404-1-qperret@google.com> <20210527125134.2116404-2-qperret@google.com> <87sg2123pj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87sg2123pj.wl-maz@kernel.org> Cc: kernel-team@android.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, will@kernel.org, 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 Tuesday 01 Jun 2021 at 13:02:00 (+0100), Marc Zyngier wrote: > On Thu, 27 May 2021 13:51:28 +0100, > Quentin Perret wrote: > > > > The hyp_page refcount helpers currently rely on the hyp_pool lock for > > serialization. However, this means the refcounts can't be changed from > > the buddy allocator core as it already holds the lock, which means pages > > have to go through odd transient states. > > > > For example, when a page is freed, its refcount is set to 0, and the > > lock is transiently released before the page can be attached to a free > > list in the buddy tree. This is currently harmless as the allocator > > checks the list node of each page to see if it is available for > > allocation or not, but it means the page refcount can't be trusted to > > represent the state of the page even if the pool lock is held. > > > > In order to fix this, remove the pool locking from the refcount helpers, > > and move all the logic to the buddy allocator. This will simplify the > > removal of the list node from struct hyp_page in a later patch. > > Is there any chance some documentation could be added so that we have > a record of what the locking boundaries are? Something along the line > of what we have in arch/arm64/kvm/vgic/vgic.c, for example. Sounds like a good idea, I'll go write something. Cheers, Quentin _______________________________________________ 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 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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 46D51C47080 for ; Tue, 1 Jun 2021 13:32:43 +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 106E4613B1 for ; Tue, 1 Jun 2021 13:32:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 106E4613B1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@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: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=jScyn3JPtJ5nmKOmgixl7ue4EpJipPWKBoZmYCAXrCM=; b=uf3cD2dLYWqwkG VIoY+1qgd75WFhYL4Hgi6kgMXmg8U41iafD0DmRMmQ+cgR9AA/+3aTV/WGTuVpftpDloX2/3vtCC2 GeyxKttWGm39hmDh6Q3QdrBOrJxrJUvxkXWqtXL/ynYQP2htRKE2+Oe/3e4DHYi4VJJbUps+JiVXq gjDTx3EWBoGZqi4qJD7taQhoen57ymMRen+PZv/b6giVIpZdt9hCeGNfrk7ogTo7Bi/Im3PqF6Gca j59emiogZrf7/zuzcEJ+i+FdQzaG6gBZDbMqtgqxv7FPDb2Nvs7Q2zOKJrGhN3I0R178IuxjU/Lmx dIgHE6xklGnfXSM6xuIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo4UG-00Gmwq-HG; Tue, 01 Jun 2021 13:31:16 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lo4UC-00GmvF-M2 for linux-arm-kernel@lists.infradead.org; Tue, 01 Jun 2021 13:31:13 +0000 Received: by mail-wr1-x42c.google.com with SMTP id l2so6875568wrw.6 for ; Tue, 01 Jun 2021 06:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=LP2fsEvMTFs8wSLGgZY1ubi1BD83fbQR+WWGlnKbnhrJzkcoYhZUlw/ZkFPHVRX2pS 1kxI8JgLhb0g3kz0pGI8o3ABqCJYAa0imQmWdnz1EWZGapSxVVG0FE8I2m7eCNFp+FhJ LX0uC4VCrnahVcOZ/Fet/aQm0qdopbZL6zqs2RlZqUjc4xKX7utUPhIEuwzdWLNG7IVz ++liR5Sn4WQaIdIQG2oJDi6hnggLc2WP6sfG4+RcODkWpixbjWvXjXfdGBeUfjYhoY1y DhzTNVl41otb4rKKFkL85f8end5tGK+CpDfjGjCeZ4NEEnEvWdsyM8i67qe/y/1t0Wyt kmQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ceM+pzGaASjItNNpKWFEaDd0DaKnxYhb/K4oaZ7JsPI=; b=bPY9vXokO9WdQmCXDrKJ9OfoxL3hnEbYHN2znimdWXRs8j5eodS1vt/gXntvlVBWSg 8oMwkS2MKbnyUG6whnaSiqaf8OBIzmc2RdipFBsSkufuSluumaSb6shVqTTooFj3njrO VxpJlWimyidR2hh5H3w3fQYs9BW1YVcOU0plaTA7IyQ8UbzNadxRa2ZXzJjMUuAsewmq AzZFh5BgNLEailw/f/nPZYp27Zye4KG59ppTlNfG5tNgnuALOxIpCVCjJqlJ6KRnYEL9 Vs6x9lDkU4KzbniKkvZeuS8wQUEZkbwB/WvtRBHpg/GxdV1H+5NNShw90GRTUWYjCQhH z3CA== X-Gm-Message-State: AOAM5331SjUhkJnoqhPaEceZSCUIgfjHg0Mqmf6hZWV9AcctCxZJ7opQ p1DqMtV6nV6eV2pv+Qj/Q/A55A/KQUX+tQ== X-Google-Smtp-Source: ABdhPJwkD2HduO0uUirxMSgy26JktuDamd44LHDyKx90TnuHOIIZTT9Fv/kzeN7mfG9dVVkN7NVWOg== X-Received: by 2002:a5d:4003:: with SMTP id n3mr27693980wrp.173.1622554270083; Tue, 01 Jun 2021 06:31:10 -0700 (PDT) Received: from google.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id w13sm490487wmi.4.2021.06.01.06.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 06:31:09 -0700 (PDT) Date: Tue, 1 Jun 2021 13:31:06 +0000 From: Quentin Perret To: Marc Zyngier Cc: will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, catalin.marinas@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] KVM: arm64: Move hyp_pool locking out of refcount helpers Message-ID: References: <20210527125134.2116404-1-qperret@google.com> <20210527125134.2116404-2-qperret@google.com> <87sg2123pj.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87sg2123pj.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210601_063112_774059_3A477CB2 X-CRM114-Status: GOOD ( 23.84 ) 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 Tuesday 01 Jun 2021 at 13:02:00 (+0100), Marc Zyngier wrote: > On Thu, 27 May 2021 13:51:28 +0100, > Quentin Perret wrote: > > > > The hyp_page refcount helpers currently rely on the hyp_pool lock for > > serialization. However, this means the refcounts can't be changed from > > the buddy allocator core as it already holds the lock, which means pages > > have to go through odd transient states. > > > > For example, when a page is freed, its refcount is set to 0, and the > > lock is transiently released before the page can be attached to a free > > list in the buddy tree. This is currently harmless as the allocator > > checks the list node of each page to see if it is available for > > allocation or not, but it means the page refcount can't be trusted to > > represent the state of the page even if the pool lock is held. > > > > In order to fix this, remove the pool locking from the refcount helpers, > > and move all the logic to the buddy allocator. This will simplify the > > removal of the list node from struct hyp_page in a later patch. > > Is there any chance some documentation could be added so that we have > a record of what the locking boundaries are? Something along the line > of what we have in arch/arm64/kvm/vgic/vgic.c, for example. Sounds like a good idea, I'll go write something. Cheers, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel