From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2E1F7AC1481 for ; Tue, 13 Aug 2024 15:29:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=SgdytIlSMDyKjqexkyC5pVglPXz2N4eSjj2uQv6ghx0=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1723562991; v=1; b=kBA/t6ZGbh0jrgS2fB3cPLS/GglPofrVeO9z+7fcNNfsJCXUZSox/K9hFLiw2P2DFIFbAJIt RSsDUR6kRo6iePP75LJd02tUedVdP4kY5IXBNJp0w8jwMSalp14AXThy+P3UZ0IQpchOM3BdIfR tyk/nNEH72qljjC7+91DqZeDRSu2t6Vpd58pvLyHmCs9Om1gkmhf1LLS96eadj+Ty23hb/gizsH OBGU8EZJUjg/sKpYxajq0HvzecpjqGTy6uIjQ2vp39fqwRIMsudmTRDtWZ5zN/xzMcERRAwmIR2 P9AEmFUy8nrD+1ZRG4s3zlCEhoZFM8r4tnC5s2iGcQruw== X-Received: by 127.0.0.2 with SMTP id QP9rYY7687511xgtv6GgKncW; Tue, 13 Aug 2024 08:29:50 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mx.groups.io with SMTP id smtpd.web10.75350.1723562984835215052 for ; Tue, 13 Aug 2024 08:29:44 -0700 X-CSE-ConnectionGUID: ICgM7WS1T2mnUpJZmdgLiQ== X-CSE-MsgGUID: /p87oc6VRni2g2dojGWxPQ== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="21293093" X-IronPort-AV: E=Sophos;i="6.09,286,1716274800"; d="scan'208";a="21293093" X-Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2024 08:29:44 -0700 X-CSE-ConnectionGUID: 5XjmlALRSLuKsUS4O7Phgg== X-CSE-MsgGUID: 4BZHkviJQSe/J5dmCnyvuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,286,1716274800"; d="scan'208";a="58651443" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 13 Aug 2024 08:29:44 -0700 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 13 Aug 2024 08:29:43 -0700 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 13 Aug 2024 08:29:43 -0700 X-Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.40) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 13 Aug 2024 08:29:43 -0700 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by PH7PR11MB7988.namprd11.prod.outlook.com (2603:10b6:510:243::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.32; Tue, 13 Aug 2024 15:29:41 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::a886:6510:729d:f9d0]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::a886:6510:729d:f9d0%4]) with mapi id 15.20.7828.031; Tue, 13 Aug 2024 15:29:38 +0000 From: "Michael D Kinney" To: Ming Huang , "devel@edk2.groups.io" , "gaoliming@byosoft.com.cn" , "Liu, Zhiguang" CC: "ming.huang-@outlook.com" , "Kinney, Michael D" Subject: Re: [edk2-devel] [PATCH v1 v1 1/1] MdePkg: Add error output for IoLib.c Thread-Topic: [PATCH v1 v1 1/1] MdePkg: Add error output for IoLib.c Thread-Index: AQHa7WUq0PDe6gs+TUSW4BdwNrhhzbIlTzXQ Date: Tue, 13 Aug 2024 15:29:38 +0000 Message-ID: References: <20240813094207.104010-1-huangming@linux.alibaba.com> In-Reply-To: <20240813094207.104010-1-huangming@linux.alibaba.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|PH7PR11MB7988:EE_ x-ms-office365-filtering-correlation-id: de7d424a-3316-4fd0-ca7f-08dcbbacbe86 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?XyeJ24mf0S7eiLNu1uF6Kbcr6oTEnF8TXzHzrHLENhn0NLa01m4PWDzLT6qX?= =?us-ascii?Q?EdeNguUOB04kiPOp467CpyffQW+vCwTeD/H+AbJZhyox64YlV+VSPH7cDmyK?= =?us-ascii?Q?nPv0QDlsIri3cPyIaCCNpx/35votb0uTqL/QmBmUi+HqKaSqUGx+cGCZlUhW?= =?us-ascii?Q?upK+8dBXd72Z5r94dz8iXK3wKd4WpR8z3ZU91oSMz2iGlT7Pa+OH2NEZUISs?= =?us-ascii?Q?owBl9xPdghCPfThZojJJTImoamCTevkdUnhlp2xV7kQ1gokQo2hazjC35o5M?= =?us-ascii?Q?VmEdKj+0Nk7mX1i8inzO/GGPoyLpnQwuCQD2J+HaF2Hu2LsTWLUveaxf7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yAQ+8N06KrFvzkUGv0LtZyihtQMHd7PVilqGM?= =?us-ascii?Q?vYarJjHuoLdV0Cd0yZvDMKgqgqe5jojlIhvm/kH7eV8R8w/bqZNV0DfgbEPT?= =?us-ascii?Q?QvH2cZyqZeKThCjLikdTdNK/AadVBnqzSmlOqQCx2Kpm9SXgEbdCVBSgAzPS?= =?us-ascii?Q?H9qjk74=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QXcvH9tbOQRJO/OHwrbkVwQHGsOaieaFmsG9YJiLZDyuHmdckuekHzOWQIYr?= =?us-ascii?Q?nhHDvtkeBMsCKIeKw4zZcGlvnqtSPxkL1AOqYahUWmQEDORxC6oFkOpfepg+?= =?us-ascii?Q?TjEUoLhfgMSoOO5kVJ25BQGO2B1/440OI+hPLgQTJD1fqI0ru4DLCz8JiP4a?= =?us-ascii?Q?lZIhzptoxpxkx2BTucEeB4bkHoegsTMFebZyGyrbAg5He+WxieZwLpmck1YX?= =?us-ascii?Q?jnluCDii4egwkX9ijj0ii9XMgk3OdmM/LbuYy3Lp6xWdGl/tkZLAWRWBIDdd?= =?us-ascii?Q?0/jfgL/aiKwgkZ4/ypYjo/GBJR6m3guFX28BC+XOvhD5WG02ciiHyZ9vMgs1?= =?us-ascii?Q?thdO5GEOhJM7ReH+bH7u3EwnlHtgOb/nB1ErZiyPjT7ClTUTQrQWaSVpN0m3?= =?us-ascii?Q?HVjKtClOaiWZLc301Y9U1S/PdPgTtjKvdKahluwpJYQZ7g0MavLIAnVECUfh?= =?us-ascii?Q?I/qFn8f9t88H97L6AegxVoiO4HhgDuOjOsIJ/TNiGlQ60bTTTXcRNwM2Znrb?= =?us-ascii?Q?bIxAA6NUiLal0oiLICxSZVExO675yZgLr9Pz3OfiyrUpmpDsygYIB+yK2DCZ?= =?us-ascii?Q?Kdni6Z2aE9mNWnkdZ9oKDJeMMU+gRceNtXnlkx0PP7uudwo2Iizujd12JQRB?= =?us-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SXlfTjfEYC2RIPblqpLczijaRpzGAgTX2?= =?us-ascii?Q?zZyuGbKI7xkzYYmpLg18ck+WsySW++SQf8y1d8ix233O8VbijfUftWmIFELU?= =?us-ascii?Q?lw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: de7d424a-3316-4fd0-ca7f-08dcbbacbe86 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Aug 2024 15:29:38.4900 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TP/jkaLdBRz0d64DhogSjik7215vRX3dOi8O93PA07DCKys7WXGvSAnsceKYMR/d6l3yPtTRk9sybtjbnzq2/M41ujt3IVJTf9XenNlOXGA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7988 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 13 Aug 2024 08:29:45 -0700 Resent-From: michael.d.kinney@intel.com Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: kpf5phR3bJ2c413NKsW8UWwXx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="kBA/t6ZG"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi, We have moved to a PR based review process. Can you change this to a PR? https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Pr= ocess Also, this change may impact the code size and performance of these APIs. When ASSERTS() are disabled, an optimizing compiler can inline these operat= ions. By adding conditional and DEBUG(), that optimization may only occur if both ASSERT() and DEBUG_ERROR messages are disabled and the optimization compile= r can optimize away the conditional statement as well. Another option is to use a different DEBUG_X debug log level that is not no= rmally enabled and a platform can choose to enable. The DEBUG_CODE() macros can also be used to conditionally include the condi= tional and DEBUG() message. This patch is also incomplete because there are other APIs in the IoLib tha= t ASSERT() on unaligned access. Thanks, Mike > -----Original Message----- > From: Ming Huang > Sent: Tuesday, August 13, 2024 2:42 AM > To: devel@edk2.groups.io; gaoliming@byosoft.com.cn; Kinney, Michael D > ; Liu, Zhiguang > Cc: ming.huang-@outlook.com; Ming Huang > Subject: [PATCH v1 v1 1/1] MdePkg: Add error output for IoLib.c >=20 > It is better to output error address information When Address is > invalid before ASSERT. >=20 > Signed-off-by: Ming Huang > --- > MdePkg/Library/BaseIoLibIntrinsic/IoLib.c | 24 ++++++++++++++++++++ > 1 file changed, 24 insertions(+) >=20 > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c > b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c > index 5bd02b56a1..57d05af5a9 100644 > --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLib.c > @@ -174,6 +174,10 @@ MmioRead16 ( > UINT16 Value; > BOOLEAN Flag; >=20 > + if ((Address & 1) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioRead16 invalid address: %lx\n", Address)); > + } > + > ASSERT ((Address & 1) =3D=3D 0); > Flag =3D FilterBeforeMmIoRead (FilterWidth16, Address, &Value); > if (Flag) { > @@ -220,6 +224,10 @@ MmioWrite16 ( > { > BOOLEAN Flag; >=20 > + if ((Address & 1) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioWrite16 invalid address: %lx\n", Address))= ; > + } > + > ASSERT ((Address & 1) =3D=3D 0); >=20 > Flag =3D FilterBeforeMmIoWrite (FilterWidth16, Address, &Value); > @@ -266,6 +274,10 @@ MmioRead32 ( > UINT32 Value; > BOOLEAN Flag; >=20 > + if ((Address & 3) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioRead32 invalid address: %lx\n", Address)); > + } > + > ASSERT ((Address & 3) =3D=3D 0); >=20 > Flag =3D FilterBeforeMmIoRead (FilterWidth32, Address, &Value); > @@ -313,6 +325,10 @@ MmioWrite32 ( > { > BOOLEAN Flag; >=20 > + if ((Address & 3) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioWrite32 invalid address: %lx\n", Address))= ; > + } > + > ASSERT ((Address & 3) =3D=3D 0); >=20 > Flag =3D FilterBeforeMmIoWrite (FilterWidth32, Address, &Value); > @@ -359,6 +375,10 @@ MmioRead64 ( > UINT64 Value; > BOOLEAN Flag; >=20 > + if ((Address & 7) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioRead64 invalid address: %lx\n", Address)); > + } > + > ASSERT ((Address & 7) =3D=3D 0); >=20 > Flag =3D FilterBeforeMmIoRead (FilterWidth64, Address, &Value); > @@ -404,6 +424,10 @@ MmioWrite64 ( > { > BOOLEAN Flag; >=20 > + if ((Address & 7) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "MmioWrite64 invalid address: %lx\n", Address))= ; > + } > + > ASSERT ((Address & 7) =3D=3D 0); >=20 > Flag =3D FilterBeforeMmIoWrite (FilterWidth64, Address, &Value); > -- > 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120326): https://edk2.groups.io/g/devel/message/120326 Mute This Topic: https://groups.io/mt/107873366/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-