Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2325951pxb; Mon, 23 Aug 2021 18:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvoD2dZf4kzpAe3HyyHcS5H5rDm/erXYrfSQgwVxZFi6aqRhqLpddrAg7sEV8/k3cJTjYu X-Received: by 2002:a17:906:c25a:: with SMTP id bl26mr7892782ejb.345.1629767885159; Mon, 23 Aug 2021 18:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629767885; cv=none; d=google.com; s=arc-20160816; b=ZQsd339NEy1edydocBrHbWzUQEsE02wfI3vpQX2Ue2aZZbsOPKUzBn0SflDuc59BC8 e4/Xt4hdlWs/wwfXallHEkH5q8NXwQ2W0cl83R804VKRhA2T9uoFlnsFHqPmjy11wBXz a4CRNleklbnngtaSndiDMNj5zOxwQIwlohOa5p2XQwW8eRm5UlzghcpMp4JXRAL9Xuff 3tff5CAxp0VHcqi/quiMLRMhER+baMSrf9DFiWulO6oPGyEw6rfvX6A5x/mXWHSURCCv ZLaBuogNJ5PQRYaNI0NVLSaOPDy6IDAedkmXxSrjio9E5r9xn8yHpbEvYWFYsm2DljZt aNfg== 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 :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=9FdG6vF1jJHHxA66vU52qbkghxCElvrKGyu+4GFLbjY=; b=CIwbPLQKwaFnXGNFoJWM24FKRjYJVfN/HYaJ1hhx3QMkv3hElCzUT/HWL6oGqBfISd zgGVrQr7D9gYijG51QXA1QO31ez2C5mqMl3xQXvW2tbjor22Z0MJpeSVuiGv0r/srhZh 7WuBt3KGQM+Fo7pRtxxhbzn/oP5XgdKnawxgTce3tk8UaA1fJKG1IFGOM1rYmOndn6vP Y3Gqn/OiTr2ru2saq5Bz8dGNDqKW7MD87iH64/XHV62Erp7/jRaCIT1m/uWu0csa+6LQ NKwVlmg56TRakF75HR/hmVAqk25+ASRIIgR5ODTRK5LLiNhrgaRPE8wT+oOcf8ZO2Kc+ aH8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fTTCaiLL; 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 a18si16391995ejj.147.2021.08.23.18.17.40; Mon, 23 Aug 2021 18:18:05 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fTTCaiLL; 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 S233441AbhHXBQ6 (ORCPT + 99 others); Mon, 23 Aug 2021 21:16:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:45676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbhHXBQ5 (ORCPT ); Mon, 23 Aug 2021 21:16:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B773C61027; Tue, 24 Aug 2021 01:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629767774; bh=ekDtvYKAlbCftbuIBYVlLpODh9IVH8ezEybZDfXZKlM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fTTCaiLL+T5+TNhz7WyeJwCMVO+UMsQirJiA62/vVpGhfr5GM1IEuEKB7GCRpC1M3 heCvYdSXOGKGSBJAQIRW0dNXG+GLfdbBhfJjcrtXwi/DnRnYsH5jiokSjeozU3SNGY 1p4totkh9wf3fvB+QHFePJ1AYMMoPIiN8x+dWDc0jDzmRDcUA+bhAyGck2LqPKWJ2e 6acukbqbxBVURrsSkJhym861m+PmkZvHLbviFn6ru2/kXOK48F2CSddmBCbFLKUF7i U1APV72lCXW/a4GaTEbXMlQPEsOySFEG5EnAQpDWgDeHYvfKAp/ZjjTmwaxqjbihD3 u3NkeNUgYbTxg== Message-ID: Subject: Re: [PATCH] x86/sgx: Add SGX_MemTotal to /proc/meminfo From: Jarkko Sakkinen To: Dave Hansen , linux-sgx@vger.kernel.org Cc: Shuah Khan , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Jonathan Corbet , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Mike Rapoport , "Kirill A. Shutemov" , Saravanan D , "Aneesh Kumar K.V" , Krish Sadhukhan , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Date: Tue, 24 Aug 2021 04:16:11 +0300 In-Reply-To: <8e6e42b0-0a1e-6892-b601-ce4a94172ef1@intel.com> References: <20210818132509.545997-1-jarkko@kernel.org> <8e6e42b0-0a1e-6892-b601-ce4a94172ef1@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-08-23 at 08:15 -0700, Dave Hansen wrote: > On 8/18/21 6:25 AM, Jarkko Sakkinen wrote: > > The amount of SGX memory on the system is determined by the BIOS and it > > varies wildly between systems. It can be from dozens of MB's on deskto= ps > > or VM's, up to many GB's on servers. Just like for regular memory, it = is > > sometimes useful to know the amount of usable SGX memory in the system. > >=20 > > Add SGX_MemTotal field to /proc/meminfo, which shows the total amount o= f > > usable SGX memory in the system. E.g. with 32 MB reserved for SGX from > > BIOS, the printout would be: > >=20 > > SGX_MemTotal: 22528 kB >=20 > The big question here: Do we want to put purely architecture-specific > entries in (the currently quite arch-independent) /proc/meminfo? >=20 > The current "DirectMap4k/2M/1G" entries from arch_report_meminfo() are > arch-specific in their sizes, of course, but the concept is at least > quite arch-independent. I started with /proc/meminfo instead of /sys/devices/system/node/*/meminfo because there is pre-existing arch callback, and secondary because it's als= o better fit for my kselftest code. The same discussion still applies to both files, they probably should follo= w a matching pattern. /Jarkko