From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.6105.1675376978333154438 for ; Thu, 02 Feb 2023 14:29:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=fko+ab2X; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=039711722c=brian.johnson@hpe.com) Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 312KYumk032248; Thu, 2 Feb 2023 22:29:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=zMzxNyg2oyaoetYb1oXTbT6CqjHLuPjBnNkTyESj6WM=; b=fko+ab2X8p/B8xhziqvGRiufHcsYmXpPO3+xtkTwUQytwq5ysTh2npf3BEzuveQ1Tfgo V7fZAKsJcOmpaL45pkQgDHtbgHBTMVv7iRTb0KUg+5tK0NNQcNCRFcCW4HfUmhoc2YcP KKrx/0S8CVtxKvLYj+RM7JgYABX37J0IKxtkv0uy6GDbWiTLkVjRuEuzCZNL5IuUwPqf BRLr8NjFN7afWNNU5/6+PAppwl5wT2jVrM1E7SxNZHQG9FJelHevfCQ7sxYv2pkhhIJR SG5CvWUnyfzVYFI8Xbo1ZIsx5FuEp1Tb9Ehb/MOyfSbNTiVWzz7wOT74BVb/3B9fAlm/ Pg== Received: from p1lg14881.it.hpe.com (p1lg14881.it.hpe.com [16.230.97.202]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3nggvxu713-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Feb 2023 22:29:37 +0000 Received: from p1wg14925.americas.hpqcorp.net (unknown [10.119.18.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 22BEE805E4E; Thu, 2 Feb 2023 22:29:37 +0000 (UTC) Received: from p1wg14927.americas.hpqcorp.net (10.119.18.117) by p1wg14925.americas.hpqcorp.net (10.119.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 10:29:17 -1200 Received: from p1wg14920.americas.hpqcorp.net (16.230.19.123) by p1wg14927.americas.hpqcorp.net (10.119.18.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36 via Frontend Transport; Thu, 2 Feb 2023 10:29:17 -1200 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (192.58.206.38) by edge.it.hpe.com (16.230.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 10:29:17 -1200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NHdPaGZWg72IrmTIO+ekkZ/Gc2hJVL0fBJ3gfTjpYWPAZLxWfyBbAh+znco6YdVEfZNDE8XJlsPovGuYBlUueUKxOVfe+Ffz+J/GLbddKGlktVACb5TjqkE6zYj2K/tww8b/kqLMyf/9diUnFVKy2jM9TQJymUkaYNtNbMNCIlF0pJysFuwKLgJzB+lP1agYrg3Gu+2kMYD1gVmdEM2im/X71ycbmf7ZYgPFn2SJGhjwIc0aQPEw1cOJXpcKhRubEzOu+osdzmbkClNgbidwf8QxICMYykku1jgpX/AX52saexpXuZtoszUyUouqr0isK6+o5UtWYW905pyy3eFEJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zMzxNyg2oyaoetYb1oXTbT6CqjHLuPjBnNkTyESj6WM=; b=ZwSokYUirbxjKm2jJ5ErGJZ2s/bI9qZLcFye3RNUcrr8+wwobzULH9rGyojggTFXt6M9XfFet444qXSxnVN5kXvZhNk7s6R1YDta5xsYxQ+TTXFre4G703uv4JeKzNW0TydFHDs0yMkdopnaaCIJHNi8QGZzeLDEnNis8+j9HwQ62jbocmgb+Yi01GVjBR8L+kuKZQYxamDkDVfd4nxmu5XeI5odH6xJ1B2h9ZW7GvTq6dc5s1rmdcNROIwBugyOEswF9EN8zOPaVyIzgBxzWfkoZf0N+V+fM0N4JpONA0s+cMVs7oVKh0eR35htvjAFecvRXy2qo6JDq/9fkAz1Tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1c0::21) by MW4PR84MB1586.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1a5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.24; Thu, 2 Feb 2023 22:29:16 +0000 Received: from MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ab70:711c:35c:5a18]) by MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ab70:711c:35c:5a18%5]) with mapi id 15.20.6064.027; Thu, 2 Feb 2023 22:29:16 +0000 Message-ID: <525d8100-b306-d1fb-08c4-e5e2cc6204e2@hpe.com> Date: Thu, 2 Feb 2023 16:29:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data To: , , "Ni, Ray" CC: Laszlo Ersek , "Wu, Jiaxin" , "Dong, Eric" , "Zeng, Star" , "Kumar, Rahul R" , "Kinney, Michael D" , "Zimmer, Vincent" References: <20230118095620.9860-1-jiaxin.wu@intel.com> <20230118095620.9860-2-jiaxin.wu@intel.com> <20230118111913.xgjlxdhngzwhvf76@sirius.home.kraxel.org> <8142cc40-ca21-2748-a3de-d0432ccbdc07@redhat.com> <20230202125158.bx7amq2nfibhimvf@sirius.home.kraxel.org> From: "Brian J. Johnson" Organization: HPE In-Reply-To: <20230202125158.bx7amq2nfibhimvf@sirius.home.kraxel.org> X-ClientProxiedBy: DM6PR03CA0098.namprd03.prod.outlook.com (2603:10b6:5:333::31) To MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:303:1c0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW5PR84MB1354:EE_|MW4PR84MB1586:EE_ X-MS-Office365-Filtering-Correlation-Id: 82bf1b0c-2b22-4545-1839-08db056ceb18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QqwDSY1UyoaTbE/ZSTJFfQ8MbR7dfPRZ0xgcD8SvdYXI+eS8IGf5C8CIUgEtpHW+9VI6Q6YUHVXfkyvMtrzkODHjrozEOhnz+/uomohainRuLQrCR55uVDdRIegb6ZURPI0tlHR9xXbX19O1Njcq9rMqjmOrdFG6HzqsHowlng+5TS70+TznkjwhXB4kXKYHXUdUbzCtz5er36ka3ebEWILwtrvI7YNUWKiXTy2vwKhsg5yMMM3b7pUfRkbIXimz6vTWbGOCGKxgmJPFkcAbLPR3Il1RwSMW7l19HkYkL8cpUAVceEpAvrotb/YYEHtEewFi6zLneF+VkV4X9C5LB5KRehz/NOj9d8bfk6a0egLcrsswP8ZYwHVBaXTIPTMqQPdlpSn4a9m+pw6z1UX1av4LzTMXoyBWOoE6RXys1c9ONAmegYa2CnpF5PBsAWGWP8B5Tt+KJti1C817/zNXfFVaOACRGIhnIC9xlpVoYbQw7WwwPiAmO7dmCF+h19zaYNmjIQHVOJ+PoeLcS5WRvFriZkk0whxwyt08SyZo5WXG/Kk1I1Fbl7C1TZm3j9D7CY3/wWRj8NP+/5Oua+fIza2pN0V0tX31DkWoXHDqs6/1ffsL/updY/FvfFbygt3dAbif+TLoxY9JryY6zeg/QsMcNG2dSPzAP8g2w60lS6csAM+30AxekWY7koLOhQxpXJAIHgZKmpunC3mzJudpIGnR9iWDPjmsFL0UJ+Ui14A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199018)(26005)(6512007)(53546011)(478600001)(6506007)(186003)(6486002)(2906002)(36916002)(83380400001)(31696002)(86362001)(38100700002)(36756003)(7416002)(5660300002)(316002)(8676002)(54906003)(82960400001)(6666004)(41300700001)(31686004)(8936002)(2616005)(4326008)(6916009)(66946007)(66476007)(66556008)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rmh3aHh6UWVRNkNyL0QyV29JMkU2WFV3OFdsSnhJYXBPR283bGVTckJTblpy?= =?utf-8?B?Kzh3azBpTEd6VVdYcTlVQnFNTUZQZy8yMzhRVkgxWDdPdmJURFlWa2d1L05w?= =?utf-8?B?dkFha1pxdktRbEZZT0JLaWI3KzNOKzZXbGI1QUV4WGp0c00zV3huR09kN0pw?= =?utf-8?B?UFNGVytwWV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MQkxaS2NL?= =?utf-8?B?YXpJZWMwMmJtdXJBV1loTXNKL3RWWGQwQnYzMW1kN01DNFVnbjIvbjJMSktW?= =?utf-8?B?L09ZWXJ3WnNTRll5WXpyVFljQU5RNEZtWHlLeW41NVF5V2EzaWVka3pFeVVw?= =?utf-8?B?V1RlemdQMEFmdjdudGtzaVB4enI2VXZjNk1EZzFpTjlCYzR6Nnp0d3RCd2ND?= =?utf-8?B?YVE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 82bf1b0c-2b22-4545-1839-08db056ceb18 X-MS-Exchange-CrossTenant-AuthSource: MW5PR84MB1354.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 22:29:16.3138 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QY6jLTINtkmgNovuTuoFFTuTEi+FH8w/LItYrQ6jk16KAsoCvYcendUtJu0oAAmecwQYS+s78Xa9xBpV1ukfvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR84MB1586 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: CihD-JVb-AO-AaZ2QHULQmG9ILvLUX8c X-Proofpoint-ORIG-GUID: CihD-JVb-AO-AaZ2QHULQmG9ILvLUX8c X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-02_14,2023-02-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 mlxscore=0 clxscore=1011 priorityscore=1501 phishscore=0 adultscore=0 suspectscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302020200 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/2/23 06:51, Gerd Hoffmann wrote: > Hi, > >>> - With relatively many elements fitting into a single HOB, on most >>> platforms, just one HOB is going to be used. While that may be good for >>> performance, it is not good for code coverage (testing). The quirky >>> indexing method will not be exercised by most platforms. >> >> TRUE so I propose that the first version of the code change only expects >> the HOB.NumberOfCpus equals to the NumberOfCpus returned from MP >> service, meaning the code logic only supports single instance of the HOB. >> When a platform that contains >8000 cpu threads resulting in multiple HOBs >> produced, the expectation will break and remind us that the CpuSmm driver >> needs to update to handle multiple HOBs. > > Given that this is already the second case where we hit the 64k size > limit and I expect it will not be the last one: I think it makes sense > to introduce a generic and reusable concept of chunked HOBs, so you can > add helper functions to HobLib for splitting and reassembling, with a > struct along the lines of: > > typedef struct { > // offset and size of this particular chunk > UINT32 ChunkOffset; > UINT32 ChunkSize; > > // number of chunks and size of all chunks combined. > UINT32 ChunkCount; > UINT32 TotalSize; > > // chunk data > UINT8 Data[0]; > } EFI_HOB_CHUNK; > > take care, > Gerd > Gerd's suggestion could be handy. Here's another approach when data is too large to fit in a HOB, which doesn't require splitting up the data: PEI tracks page allocations by generating memory allocation HOBs (EFI_HOB_TYPE_MEMORY_ALLOCATION.) The EFI_HOB_MEMORY_ALLOCATION_HEADER structure in the HOB contains a "Name" field of type EFI_GUID which can be used to track the purpose of that particular page allocation. It's zeroed by BuildMemoryAllocationHob(), and not usually used. But if you put your own GUID in there, you can use it to track which memory allocation HOB corresponds to your data, without having to manage a separate HOB with a pointer. The allocation will be automatically tracked through pre-RAM PEI, post-RAM PEI, and DXE, and the pages (although not the HOB) will even persist into Runtime (if you use an EfiRuntimeServices memory type.) That wouldn't help the OP with SMM, though. They would still have to copy the pages into SMRAM somehow. Unfortunately, neither HobLib nor AllocatePages() has an interface for setting the "Name" field. But you can call AllocatePages(), then search the HOB list for the resulting HOB, and update it's AllocDescriptor.Name field. -- Brian J. Johnson Enterprise X86 Lab Hewlett Packard Enterprise