Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp486704lqp; Wed, 22 May 2024 10:06:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGZ1Ksg2slSFKT2tkYM0AWCRGo2zarQZ/iKgQ2t/ZU0dHhTP9hPB+9lfyT8+6JiRAWUEWWa+Cs+2edYPRNKu1lbuvCnvMKoBrPWKUvnA== X-Google-Smtp-Source: AGHT+IGU9gxJlaLetARXXJWxd8ZVD0mfl66bX6dBK0DMttajD0OZJ9Rz4xKdTeD+3BYqGKIl4neM X-Received: by 2002:a17:90b:716:b0:2a5:be1a:6831 with SMTP id 98e67ed59e1d1-2bd60426bf1mr17838405a91.19.1716397576062; Wed, 22 May 2024 10:06:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716397576; cv=pass; d=google.com; s=arc-20160816; b=O2nf7Ts2MfdnqLja9uWj4AF7yLT/v/BXl97osYCES7s3io0cUkTPI8nj0JZZ+5hkM9 ixiBuzKkRoU6TrhClqkBG8AHJGToyTRc9Hc4GwYun1F17NtppnI6dzP42Ol5kuZRDCvh 58dPOjuRADiH6TH3fyQZAVkoNJYM/tHr1i+hCj62WOeBH8w0Bn821HGaff/ngp2wOE6I pHYuBZPZbaHmgZrxn77iDkJQ+zpgIichi1IscNuo9CFyN/N76PK9hCcQabE9DCojtdHV 0uGVKA0BjfvbIvt3Q2bWtdlutAfF1/xeXmDEYKjfmVhUbbVYC22s4BVsPKASvS+Hxvum 2ZOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=YP7/mGhQKw1ExsHLJMlhr19hROrecwrsXEcVYSQKNF4=; fh=0PvXTblvcOsrMPT3yEGqxR5sUU4n6OEeMAbaOpzry54=; b=BggDkakbtfXPiTAThxDM4bRYG9nXry9kSuGD8aR5Fdst/f7XLeqWMVe7dBxgBLInxh KBq61xWm1CwcMhLol6DXKWHK1+6esfRgEVDJvFEFbgdrqxB5ET9Cs7RKYrTFG35+nyu2 b1J5GxYBNA3LqFLn8PNttsxZJSXI7dvtcu/erTfXOVGJoxdxdJ3JVLOiSIT83oJDW9E9 f7fw2lrJFwKeC9l0G1VTsIUgYg/QlzB4f0JrZZp9S23i0VNGxX6xqOXBIljVFAVAvS1/ KkzMsZCx3gI3LQ6xRjVOYFbUbKKrg5d/y7vZNMqXHrRCKr6Iu+mS2v2DoPIDCVLd6/Uv 9GKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-186534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186534-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdd9f30ce2si8861a91.138.2024.05.22.10.06.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 10:06:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-186534-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186534-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6FC1DB21305 for ; Wed, 22 May 2024 17:06:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 132FB142910; Wed, 22 May 2024 17:05:38 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 838C41F17B; Wed, 22 May 2024 17:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716397537; cv=none; b=dln0lB1/rdve/SuN+eEN3AiE5S9XaIxy/Wf2zg1o4a3iKK0bZibDJg4Fz5A2WQS1JyL8eb3s6dCewpj2Dq2mImex354/MBnyK8KRwtxz3vCuOrPoB04CEcUgLjgGXpWrdIxBLBDyCApOk2b908F/P8AFbBQcuAL0uEEYigEB/yo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716397537; c=relaxed/simple; bh=mwwMo0Vvvhtk4BnzEWt4A3iCr981iZe9k75eEk/w0xM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UT0zFNwQOh9MJTr6S43dnGpuSfOo9zs3WVhTirWfe0wy1dBEH98mwLyIdEUtGJ9cINuucT6MZhgm7B5BkQz8+qsAouGWVWKJwEYKAQda5939Ngaup5Qj2nKZ6k+6a+j8ZC4v+s0c39CuRTA9FSVieittqqYGudjTSg4n6DaTjes= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34ABEC32789; Wed, 22 May 2024 17:05:34 +0000 (UTC) Date: Wed, 22 May 2024 18:05:31 +0100 From: Catalin Marinas To: Steven Price 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 Subject: Re: [PATCH v2 12/14] arm64: realm: Support nonsecure ITS emulation shared Message-ID: References: <20240412084213.1733764-1-steven.price@arm.com> <20240412084213.1733764-13-steven.price@arm.com> <74011ac1-34e0-4ee3-a00d-f78ad334fce2@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74011ac1-34e0-4ee3-a00d-f78ad334fce2@arm.com> 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? -- Catalin