Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3681968pxj; Tue, 1 Jun 2021 10:42:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymUcNkp/gyJbj9DT2HE1AJGg2dDR6XB0ZIP5D7b8oRVB44p2BC8qvA1gZnh0rFFlajyacL X-Received: by 2002:a05:6e02:1a45:: with SMTP id u5mr10964814ilv.142.1622569362857; Tue, 01 Jun 2021 10:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622569362; cv=none; d=google.com; s=arc-20160816; b=YWT6bXCee8u4J5Yi3O4h0pTXpBlGRAixqMWowi2j6Q+ulDruQRiT1GaNFkJ3LWeM/G ma9pf3zWdYx5RbVyq7Fzm3xo0iXdjGC5I/FWn1VJcWWM2ARYYkUFgghYOogPcs+LoVpn 2UfRd+gS/6mIO8lwWwOwEJIwPWnCPa++xtiCwDKPver2hyFTnzrouGB1gfKaTBlb1PIf 1l2en+gkrFo/N/Q3kfundL9nSXlEHNrUutOkzcca0GGvn9mXHuBEUZCEFsndh1Fs5QBy lpqq4A/kPtedhOrnULSdHoCyrIunju5wHivFTnuHpHIRGvb/o/hkW/UhEWt3xGjbOpiq wl5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=vdUiMW1ndXQUbaVZKVfhw8jxwG/O+FjtEZKVIvN/YTI=; b=SbjchfHMiW5HGVp+QMHsX7UWAruWuTbjsSMPcHkSJik63g0g5AOj2Ah0SyTWpkFAYJ JRW3ByTE/8DQ7iHeKUafPE1lsPKtf6m2XKebB8k9SgO3Po7rSHTm6+qG54MrhoiS7op0 b+eDabOUjdfXKSVAOPu9fNm/GCDb3jePB0arlnFVsBCcdeIc553TjKWuHcsYRo5GbuxW OKIKyl+MBpvKhUXV7Fwd2FNzPsyR6iLU6QPF2rSPnaabbdJWUBaIPqZK8E0zjPOOWByA wPh0Y07Tlra7f7WtYaj00te7TbqP0UeZtc/tIWgM7kTNsWL1MK+UcLbnyO7nNCZmiKSD gq1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si13819369iom.52.2021.06.01.10.42.29; Tue, 01 Jun 2021 10:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234581AbhFARnf (ORCPT + 99 others); Tue, 1 Jun 2021 13:43:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:33732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233397AbhFARne (ORCPT ); Tue, 1 Jun 2021 13:43:34 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95D58610C9; Tue, 1 Jun 2021 17:41:52 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lo8Ok-004s0J-G6; Tue, 01 Jun 2021 18:41:50 +0100 Date: Tue, 01 Jun 2021 18:41:49 +0100 Message-ID: <87fsy11nz6.wl-maz@kernel.org> From: Marc Zyngier To: Quentin Perret 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 3/7] KVM: arm64: Remove list_head from hyp_page In-Reply-To: References: <20210527125134.2116404-1-qperret@google.com> <20210527125134.2116404-4-qperret@google.com> <87k0nd1wgx.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: qperret@google.com, 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 X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 01 Jun 2021 16:48:06 +0100, Quentin Perret wrote: > > On Tuesday 01 Jun 2021 at 15:38:22 (+0100), Marc Zyngier wrote: > > On Thu, 27 May 2021 13:51:30 +0100, > > Quentin Perret wrote: > > > +/* > > > + * Pages that are available for allocation are tracked in free-lists, so we use > > > + * the pages themselves to store the list nodes to avoid wasting space. As the > > > + * allocator always returns zeroed pages (which are zeroed on the hyp_put_page() > > > + * path to optimize allocation speed), we also need to clean-up the list node in > > > + * each page when we take it out of the list. > > > + */ > > > +static inline void page_remove_from_list(struct hyp_page *p) > > > +{ > > > + struct list_head *node = (struct list_head *)hyp_page_to_virt(p); > > > > Nit: How about changing hyp_page_to_virt() so that it returns a > > convenient 'void *', and get rid of the ugly casts? > > It should already return void *, but I kind of liked the explicit cast > here for documentation purpose. We're turning a 'random' piece of unused > memory into a typed object, so that felt like a useful annotation. Happy > to get rid of it though. My expectations were that using hyp_page_to_virt() already serves as a pretty big warning that we're doing something unusual. I guess that if we want to be really careful about those, we should then be consistent and make it return a uintptr_t (or unsigned long) instead, actively making use of the cast, consistently, everywhere. Thanks, M. -- Without deviation from the norm, progress is not possible.