From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FE501CB325; Fri, 1 Nov 2024 16:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730478178; cv=none; b=XYQybGn09rHylEfVTGm9kLC+sIIMLrEmeDKnCVdCxQUGJsGbKUoYdrcTcDyDdoW2MEkExbTD9QfVwkskJ+ztxvL1DjZQ3PcGojwREfN8lmI7LoMRyPLLpqhAlVhesdMyO/KUuTROg/Md5zPkfMI8k/9iBH5NzfBDxbxzenFA/go= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730478178; c=relaxed/simple; bh=1CK+Pj/7Vm/XZD+AgmGRgSHzdRtBShTZGZhCe1Ise10=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=A/b5pf/N7JxT2bcn6oT5zxx6NpQJGeVAN2dgqdrhy+hhIerwGilWGUpAl3ugbAImBcSww+QWRoAFZ0Dr0uI0ZbOFwGpSukM+0WZb/SPsMEdR4kIVd8qPr5EduZzQ8bOOGQ/SOBxC4Yj+9g1zMOXHYrd/Mh3VPbv1F0zyI6uZ5bs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63407FEC; Fri, 1 Nov 2024 09:23:24 -0700 (PDT) Received: from [10.1.33.21] (e122027.cambridge.arm.com [10.1.33.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E53A63F73B; Fri, 1 Nov 2024 09:22:47 -0700 (PDT) Message-ID: Date: Fri, 1 Nov 2024 16:22:46 +0000 Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 09/43] arm64: RME: ioctls to create and configure realms To: "Aneesh Kumar K.V" , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun References: <20241004152804.72508-1-steven.price@arm.com> <20241004152804.72508-10-steven.price@arm.com> From: Steven Price Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 30/10/2024 07:55, Aneesh Kumar K.V wrote: > Steven Price writes: > >> + >> +out_undelegate_tables: >> + while (--i >= 0) { >> + phys_addr_t pgd_phys = kvm->arch.mmu.pgd_phys + i * PAGE_SIZE; >> + >> + WARN_ON(rmi_granule_undelegate(pgd_phys)); >> + } >> + WARN_ON(rmi_granule_undelegate(rd_phys)); >> +free_rd: >> + free_page((unsigned long)rd); >> + return r; >> +} >> + > > we should avoid that free_page on an undelegate failure? rd_phys we can > handle here. Not sure how to handle the pgd_phys. Good point. I think for pgd_phys setting kvm->arch.mmu.pgt=NULL should be sufficient to prevent the pages being freed. Thanks, Steve