From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.51]) by mx.groups.io with SMTP id smtpd.web09.9106.1638456626316239597 for ; Thu, 02 Dec 2021 06:50:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=E69NRcS4; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.100.51, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UT+1T0SR7+qzLVHUUzFjJgX1aIWH9k2Y+LSlmxvCZi30CyNhQX1/LDKxOLV5AEjiqb/cEl5dMPiNcDc/9v+q+l5T1xgCCGQ449P3fBsX9iPmT4GwGY7X85+B7PGTNmOJUQA4wtIBQskhUrwZDHXfCuocSZMJJ+jzcjXzmyli3Ow9LQk+BfXPn0ERS7LWeq+HYjJxErwHE6vO8cyZxMRhHsBh5L6kTUB3HpsNDprhA5UEQyD/t5kdNv69EoHzthONvREHRsENybDiK452FKFK+gBRH+YjCKgp2Z5sYEr720P1dQlm2CKaF9Sdf1v42XAlsfbLLRWEh6EbfUFrrFFudQ== 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=u+QF9ioPmxz2flagQjUglRjm0unbzJyCPmSRgvgzaSQ=; b=BxMUfD4HZjmq7AK4fBVzRhCLUpuETDC5Fi9HpH9G/NdANGujWDgrHe3+IBNvhbeODMFfA1v/rbM03qapUTTs80HO+A39G+UolMymqUUkrB951dxuRg8xWrujvXmbiAsiCSzIhhKChbkVsniCYCqMCmxPVzmrIG0uW+sq/9Ufa5ijNJbJAF58SW6iMmC++hm0adVcp1c1dx5m2cx/w5gpSXMuHWzpHlVsje7BBa8GRAh+BelpNaD0jrRuWTv7V9oaIp43ImAXYnmaZSZ5NRZfpwcycVNIiUABdrAXOXUyEmlgg12OFCRlZ0EAxKbcLTEA6FtCxGVAXCR+f2IpjNTzEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u+QF9ioPmxz2flagQjUglRjm0unbzJyCPmSRgvgzaSQ=; b=E69NRcS4ISi7RRtaxWdv1CICI+bJj+Prr6SACIYhzgNbFVHXbz7RGUlgy7tSZCexTsL3/1jw2lrlUi78/mk1+10d+lzs9bEfpQnHoT5/r8u13V5jIIHcxpowF4T6ryr5sdHaj2igi/FdhEOc3xw+dMsJk6ar+hr11vE/OcZSXnz0/qxbldF/GsBkrZEONppNoHX6lMjgt/66iT7loGDn5TNK00RceSoS0TJDeWMkr3zQviTMknGOhHuoEj4oGfipjhlJh41dgZpIUmN0GqJM8LoJueLMcHOZ3wApio58C6NmXsNA+EiNHntZ0WGoAhoIUXM+6EztGo/q+2g8VVJEgg== Received: from BY5PR12MB4132.namprd12.prod.outlook.com (2603:10b6:a03:209::22) by BY5PR12MB4049.namprd12.prod.outlook.com (2603:10b6:a03:201::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Thu, 2 Dec 2021 14:50:24 +0000 Received: from BY5PR12MB4132.namprd12.prod.outlook.com ([fe80::89b4:53a8:7a2d:ce4b]) by BY5PR12MB4132.namprd12.prod.outlook.com ([fe80::89b4:53a8:7a2d:ce4b%6]) with mapi id 15.20.4755.016; Thu, 2 Dec 2021 14:50:24 +0000 From: "Jeff Brasen" To: "devel@edk2.groups.io" Subject: Re: Question on TPL in PCD/Variable code Thread-Topic: Question on TPL in PCD/Variable code Thread-Index: AdfnivYejQZf9QqLRL+DoC5lXEQeVwAAPAVw Date: Thu, 2 Dec 2021 14:50:24 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 39266327-4745-4249-63cc-08d9b5a312b5 x-ms-traffictypediagnostic: BY5PR12MB4049: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WVLC/nmhudgt/fT9GCCJsVm1WlAl+fq4QvZwiDCpf1Gr3Nb/3fn1l6wM3BVh7ntia9GD1mmpWVuFseaoEW2FOBw784+FZ325I+TcdROtbVyDuqlBNKhvx4CiUqVp0d72D6OmuF7lJVtxOMwKyM9pjQJR7sdBxpIHBt9gGvVRMHYEOHDrHEAGBnRl1V12ZyDJey46mz6KYjJI3Og67gUNkgqhHZ2RI6aTMy+3zIMxHVYUSzfeYw5Hzrx39eN9GDWRmf/ngpnO+XCxXORHYa7EiUX2vplglrgl3n5oYaseki/gyDdd9OMVhlYFoDV0lVlAIO9WrxPU4PAeV15ubiY0OiaVvYZfOUEXlfzRzqU2pCF5bB9UnrIpAezv7DRnP604Ool/PGVg2yXyR/Z9j5JcfcQStmCPlaIH3smkZAVN1nCr9QAoTRttaHacbxXzIc1gUr7xb7Fk6blgVfXm5+lqtNkN0stGMWMNanrKJyYxZQlQghWp16o1D6LTp2ppmdz41cmTBeqFP4M/JvPgZfVxggJNsnVixdHIPyqkJrFan0FjcMTDhZSXTXdpN9WnUfSTivfCHI+goj/QdVBN4nXidGlIuGRGJ0WbZW+E/piEzW2etdbM/qVtiIMCpFBcU3DskmHOfDsOoBJsUgEB1CSyRqGMI7atpgBTv4xGYgl1UvaES1nZs1WQbnQj3lPAAghpQjTACPkwhGLeI4tZViujAw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4132.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(26005)(38070700005)(66476007)(66556008)(52536014)(66446008)(64756008)(9686003)(6506007)(186003)(38100700002)(4744005)(83380400001)(122000001)(6916009)(316002)(2940100002)(71200400001)(55016003)(2906002)(8936002)(33656002)(86362001)(8676002)(7696005)(76116006)(66946007)(5660300002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Z/c58d1QCG73yPjieCw5MtfiOGLi2FUWs79+EVrcJzJ8o7FWRfBgJJLo1w13?= =?us-ascii?Q?G0tysAS7a7OSxXSgrAn31NEZ9CXs9yiXaQEUOMvgYQsA6N2aVwaoNtAfOYnZ?= =?us-ascii?Q?y+8inaGQLmkaWltwzIENL5+0vRSW7RFkFUBuD4yJovRZCVdZ5Jd28Lb21+QZ?= =?us-ascii?Q?7eqi9SUI5psqO5fVqIgat/cDseLMO+7BGlimZ8zElr/3e+8OaY/fKryyRl3M?= =?us-ascii?Q?SW/zlZq/6/zi23uulyglrPRSXmLM1wri3LCiGMXV93gAkiP0c2zdAQeEtWzG?= =?us-ascii?Q?q2KE7WvIbs93XV9qV3783IoaHJKf9JKFIIi7kiE2/n+BXG1oJyYDZ5LFwFB+?= =?us-ascii?Q?01MPWsCGms9ryLzpTQKVstmnTAyHcQdcaycg/m+pVdND2mk5+8U+iHLAxa8r?= =?us-ascii?Q?eikvgSLSZ/AG97oLcRPBSGl7FEoYl9u9Y5K7HHMjDbykX0XVfwWxExd8C0v5?= =?us-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V1wJy0KZkJDQZTHb/J8?= =?us-ascii?Q?v6k4VuV0UVhXR7iL0zkwZDaVcWCyqN7avU3ayXBC/50+tKPP698E4yQOhthL?= =?us-ascii?Q?FQjltiYiQXp2Mi77LDN3Lcl+DlGwYi2Ct0Z+L0a6E73ZSdrlR9ZsPxKb2di4?= =?us-ascii?Q?GO2mRzMH5h1ZldHuSabkYmSSyrx3AhdmDvxom5JEBHAKLbLV0n2GjSxBwxky?= =?us-ascii?Q?MhiWfazI91ka3ZA6cWioWlTERJUsrs74OdOOQvzfiplmMAN5E38ZyO3ku3OE?= =?us-ascii?Q?kg9ExNsvybC3ycZS7Vi9pcc=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4132.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39266327-4745-4249-63cc-08d9b5a312b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2021 14:50:24.6764 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xWAhK7Eh7wykYxocrbLwEoR2ANxyplGWxjlrJrsVo6lgC0y4Ya0E3Z8wKmvzvtmmW73uhUNvnCjaTvWORSVxkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4049 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BY5PR12MB4132706A9FB52E344900400ACB699BY5PR12MB4132namp_" --_000_BY5PR12MB4132706A9FB52E344900400ACB699BY5PR12MB4132namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I am trying to get variable services hosted on a UFS device and running int= o TPL related issues. The variable and PCD code have locks that raise the T= PL to NOTIFY prior to calling into the FVB instance and the UFS driver has = a few raise tpl calls that increase the TPL to TPL_CALLBACK. This is causin= g a failure as you can't do a RaiseTPL to CALLBACK when current TPL is NOTI= FY. The UEFI specification states that both BlockIO and Variable services shoul= d only be called at <=3D TPL_CALLBACK. I see a couple options. 1. Change the locks to TPL_CALLBACK which seems to keep things in line w= ith the UEFI spec but may introduce race conditions if that higher lock was= blocking things 2. Change the raise tpl in the UFS driver to TPL_NOTIFY. This is how the= eMMC driver is written. I am leaning towards option 2 but wanted to get some feedback prior to push= ing a patch. Thanks, Jeff --_000_BY5PR12MB4132706A9FB52E344900400ACB699BY5PR12MB4132namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I am trying to get variable services hosted on a UFS= device and running into TPL related issues. The variable and PCD code have= locks that raise the TPL to NOTIFY prior to calling into the FVB instance = and the UFS driver has a few raise tpl calls that increase the TPL to TPL_CALLBACK. This is causing a failure= as you can’t do a RaiseTPL to CALLBACK when current TPL is NOTIFY.

 

The UEFI specification states that both BlockIO and = Variable services should only be called at <=3D TPL_CALLBACK.=

 

I see a couple options.

 

  1. Change the locks to TPL_CALLBACK which seems to keep things in line w= ith the UEFI spec but may introduce race conditions if that higher lock was= blocking things
  2. Change the raise tpl in the UFS drive= r to TPL_NOTIFY. This is how the eMMC driver is written.
  3.  

    I am leaning towards option 2 but wanted to get some= feedback prior to pushing a patch.

     

    Thanks,

    Jeff

     

--_000_BY5PR12MB4132706A9FB52E344900400ACB699BY5PR12MB4132namp_--