Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp882347lqp; Thu, 23 May 2024 02:57:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1g0yrEAccXqGtBup9BiYXIVYhvSa6Wh2wsl2VbI+JlHYroTEu5QOBkSADRb6MaTnfbX3xlLBskaId3vZwkbqB+xV1oX2cQFlOoWnGUQ== X-Google-Smtp-Source: AGHT+IE6ijgsKU4nHRtC4LJNaSwXSwOqiJ0txcJPaLnA1va9bpUtzUYTBwt91z/bZNmaD7HeaYyw X-Received: by 2002:a17:907:2cce:b0:a62:15b7:c45 with SMTP id a640c23a62f3a-a6228156028mr263689466b.55.1716458274753; Thu, 23 May 2024 02:57:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716458274; cv=pass; d=google.com; s=arc-20160816; b=b+1t3rafvPabCZGoiqm/yL7mJAh7dBqOjk4I+6/iUnYfpP/qUsaWt+fspvGr1yWPRS 3NG1dZdcjWENm64UjIeLbu1RqZszYXJzwXm4Bh90cKU66lSEIdAqrw/8YGwhZp2Ppy2D wK1gglQWiSNw4KmKgxbyPkqSuktwO1QQ0fjmXBooba6c77sLMDFuJ49NeQlfnPpZ6MNL eK85dcSW6YVo+6kydMLSHg4eMEAcBOmxlL1PgvIhWz116O4yOCj5nQHEj9E8VwbnHVgs Ius6cWvEiYWNLAuGoTwCEWYgAFzVmboQb8hyXhQptgN9vHWMFX7UeAH6Fppu6NuiZYJW QnSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=2vFQPQXgQuj8IdjBe6owWJ3b8qVjB0BlSMYGOXf83ZQ=; fh=gr72O3brLFpZhr6FeDvPNeeFNEUnAC3Wruy9APIou2g=; b=cYVidvCwrsDkvTBuH8ta3NCm2CHtZrywDX3qtgR14mn+f5LJdtKZ6f5vKHxRw2+XUe aedalbMt8J5njaCGh/10FHpxnQVH5j4nuVI2CPPScB1U/M8I5bjE0lPg6cW37wC30mP6 A55Rmi+2A1cD7CePhqnrSqX5mmpG5nvNkNB5W539VOMMwmOcUHQqLH34tlczLazPkbPe rHT1gSyHjmMVGvcDvk77SnQENXU7CdiHe1m3K/6Gqvii4SQevPSMVX4oYQCfrxm+QTzR AfUfjeprNmYA+BZ2OdINHpKyPATbd6T1OU3SK+NYPxg2l1eYv8b108F5m1wkxWUPCwGA /+lQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-187295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a621c9c5a93si195642766b.420.2024.05.23.02.57.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 02:57:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-187295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7A2381F23810 for ; Thu, 23 May 2024 09:57:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE14E13DDD0; Thu, 23 May 2024 09:57:45 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 795C013D521; Thu, 23 May 2024 09:57:43 +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=1716458265; cv=none; b=d5/RhHGwJXZxl9396qqnNQDwtyY0Aj1xqmMOzNtoj5OhaIgHCu6A9GNiIlg6Kb6FLZTXChmCwir+Nb2dDULzNJDdd/gu8MmGpIlLVQ8D3AJkH8RF3KeA949f8D4Nklw/8cweFLftRZLNt3MAVoLBI7nwW9s+IFjBg+xjmibmdqQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716458265; c=relaxed/simple; bh=pJ+B3e29HJAbTyYyZa4HUjzMSv5Rh0HroDPaliFp3ZY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oKupF983S0+z5AWBCG6IDUtsR13Xt5XPGov8KcscIEA3AfkXqi7D1Nym12QNnUaFCf6UtJTMveLbarBX+DTusJ4edChX65UL1zI/PR2XHFs9QN8JZKZjV2atyc4XE0L6uyZliznM8FLFvmKNH3yzMTz5KgUpCOBJc2L9wxS5h6E= 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 9A3C82F4; Thu, 23 May 2024 02:58:06 -0700 (PDT) Received: from [10.1.30.34] (e122027.cambridge.arm.com [10.1.30.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF8003F766; Thu, 23 May 2024 02:57:39 -0700 (PDT) Message-ID: Date: Thu, 23 May 2024 10:57:37 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 12/14] arm64: realm: Support nonsecure ITS emulation shared To: Catalin Marinas Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, 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 References: <20240412084213.1733764-1-steven.price@arm.com> <20240412084213.1733764-13-steven.price@arm.com> <74011ac1-34e0-4ee3-a00d-f78ad334fce2@arm.com> From: Steven Price Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 22/05/2024 18:05, Catalin Marinas wrote: > On Wed, May 22, 2024 at 04:52:45PM +0100, Steven Price wrote: >> On 15/05/2024 12:01, Catalin Marinas wrote: >>> On Fri, Apr 12, 2024 at 09:42:11AM +0100, Steven Price wrote: >>>> @@ -3432,7 +3468,16 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, >>>> nr_ites = max(2, nvecs); >>>> sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1); >>>> sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; >>>> - itt = kzalloc_node(sz, GFP_KERNEL, its->numa_node); >>>> + itt_order = get_order(sz); >>>> + page = its_alloc_shared_pages_node(its->numa_node, >>>> + GFP_KERNEL | __GFP_ZERO, >>>> + itt_order); >>> >>> How much do we waste by going for a full page always if this is going to >>> be used on the host? >> >> sz is a minimum of ITS_ITT_ALIGN*2-1 - which is 511 bytes. So >> potentially PAGE_SIZE-512 bytes could be wasted here (minus kmalloc >> overhead). > > That I figured out as well but how many times is this path called with a > size smaller than a page? > That presumably depends on the number of devices in the guest. For my test guest setup (using kvmtool) this is called 3 times each with sz=511. Steve