From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.60763.1640834517186136017 for ; Wed, 29 Dec 2021 19:21:59 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: fanjianfeng@byosoft.com.cn) Received: from DESKTOP-M5NI163 ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 30 Dec 2021 11:21:35 +0800 X-WM-Sender: fanjianfeng@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: fanjianfeng@byosoft.com.cn Date: Thu, 30 Dec 2021 11:21:48 +0800 From: "Jeff Fan" To: "devel@edk2.groups.io" , rebecca , "Ard Biesheuvel" , "Gerd Hoffmann" , "Samer El-Haj-Mahmoud" , "Leif Lindholm" , =?GB2312?B?V2FuZywgSmlhbiBK?= , 'gaoliming' , nd , "Sami Mujawar" Cc: "Rebecca Cran" Subject: Re: [edk2-devel] [PATCH v4 1/1] MdeModulePkg: Add MpServicesTest application to exercise MP Services References: <20211212180846.6563-1-rebecca@nuviainc.com>, <20211212180846.6563-2-rebecca@nuviainc.com> X-Priority: 3 X-Has-Attach: no X-Mailer: Foxmail 7.2.20.269[cn] Mime-Version: 1.0 Message-ID: <2021123011214518968235@byosoft.com.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart673081615726_=----" ------=_001_NextPart673081615726_=---- Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: base64 SGmjrFJlYmVjY2ENCg0KSSdkIGxpa2UgdG8gZ2l2ZSB0d28gY29tbWVudHMgb24gdGhpcyBwYXRj aC4NCg0KMSwgIEkgZG9uJ3QgdGhpbmsgdGhlcmUgYXJlIG1vcmUgdGhhbiBvbmUgTVAgc2Vydmlj ZXMgaW5zdGFuY2VzIGluc3RhbGxlZCByZXVpcmVtZW50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hdHVzKSkgew0KKyAgICAgIFByaW50IChM IkdldFByb2Nlc3NvckluZm8gZm9yIFByb2Nlc3NvciAlZCBmYWlsZWQ6ICVyXG4iLCBJbmRleCwg U3RhdHVzKTsNCisgICAgfSBlbHNlIHsNCisgICAgICBQcmludCAoDQorICAgICAgICBMIlByb2Nl c3NvciAlZDpcbiINCisgICAgICAgIEwiXHRJRDogJTAxNmx4XG4iDQorICAgICAgICBMIlx0U3Rh dHVzOiAlcyB8ICIsDQorICAgICAgICBJbmRleCwNCisgICAgICAgIENwdUluZm8uUHJvY2Vzc29y SWQsDQorICAgICAgICAoQ3B1SW5mby5TdGF0dXNGbGFnICYgUFJPQ0VTU09SX0FTX0JTUF9CSVQp ID8gTCJCU1AiIDogTCJBUCINCisgICAgICAgICk7DQorDQorICAgICAgUHJpbnQgKEwiJXMgfCAi LCAoQ3B1SW5mby5TdGF0dXNGbGFnICYgUFJPQ0VTU09SX0VOQUJMRURfQklUKSA/IEwiRW5hYmxl ZCIgOiBMIkRpc2FibGVkIik7DQorICAgICAgUHJpbnQgKEwiJXNcbiIsIChDcHVJbmZvLlN0YXR1 c0ZsYWcgJiBQUk9DRVNTT1JfSEVBTFRIX1NUQVRVU19CSVQpID8gTCJIZWFsdGh5IiA6IEwiRmF1 bHRlZCIpOw0KKw0KKyAgICAgIFByaW50ICgNCisgICAgICAgIEwiXHRMb2NhdGlvbjogUGFja2Fn ZSAlZCwgQ29yZSAlZCwgVGhyZWFkICVkXG4iDQorICAgICAgICBMIlx0RXh0ZW5kZWQgSW5mb3Jt YXRpb246IFBhY2thZ2UgJWQsIE1vZHVsZSAlZCwgVGlsZSAlZCwgRGllICVkLCBDb3JlICVkLCBU aHJlYWQgJWRcblxuIiwNCisgICAgICAgIENwdUluZm8uTG9jYXRpb24uUGFja2FnZSwNCisgICAg ICAgIENwdUluZm8uTG9jYXRpb24uQ29yZSwNCisgICAgICAgIENwdUluZm8uTG9jYXRpb24uVGhy ZWFkLA0KKyAgICAgICAgQ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gICAgICAgICAqUHJvY2Vzc29ySW5k ZXgNCisgICkNCit7DQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgICBJbmRleDsNCisgIFVJ TlROICAgICAgICAgICAgICAgICAgICAgIEluZGV4T2ZFbmFibGVkQ3B1Ow0KKyAgVUlOVE4gICAg ICAgICAgICAgICAgICAgICAgTnVtQ3B1czsNCisgIFVJTlROICAgICAgICAgICAgICAgICAgICAg IE51bUVuYWJsZWRDcHVzOw0KKyAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgSW5kZXhPZkVu YWJsZWRDcHVUb1VzZTsNCisgIFVJTlQxNiAgICAgICAgICAgICAgICAgICAgIFJhbmRvbU51bWJl cjsNCisgIEJPT0xFQU4gICAgICAgICAgICAgICAgICAgIFN1Y2Nlc3M7DQorICBFRklfU1RBVFVT ICAgICAgICAgICAgICAgICBTdGF0dXM7DQorICBFRklfUFJPQ0VTU09SX0lORk9STUFUSU9OICBD cHVJbmZvOw0KKw0KKyAgSW5kZXhPZkVuYWJsZWRDcHUgPSAwOw0KKw0KKyAgU3VjY2VzcyA9IEdl dFJhbmRvbU51bWJlcjE2ICgmUmFuZG9tTnVtYmVyKTsNCisgIEFTU0VSVCAoU3VjY2VzcyA9PSBU UlVFKTsNCisNCisgIFN0YXR1cyA9IE1wLT5HZXROdW1iZXJPZlByb2Nlc3NvcnMgKE1wLCAmTnVt Q3B1cywgJk51bUVuYWJsZWRDcHVzKTsNCisgIEFTU0VSVF9FRklfRVJST1IgKFN0YXR1cyk7DQor DQorICBpZiAoTnVtRW5hYmxlZENwdXMgPT0gMSkgew0KKyAgICBQcmludCAoTCJBbGwgQVBzIGFy ZSBkaXNhYmxlZFxuIik7DQorICAgIHJldHVybiBFRklfTk9UX0ZPVU5EOw0KKyAgfQ0KKw0KKyAg SW5kZXhPZkVuYWJsZWRDcHVUb1VzZSA9IFJhbmRvbU51bWJlciAlIE51bUVuYWJsZWRDcHVzOw0K Kw0KKyAgZm9yIChJbmRleCA9IDA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PSAwOw0KKw0K KyAgZG8gew0KKyAgICBTdGF0dXMgPSBHZXRSYW5kb21FbmFibGVkUHJvY2Vzc29ySW5kZXggKE1w LCAmUHJvY2Vzc29ySW5kZXgpOw0KKyAgfSB3aGlsZSAoRUZJX0VSUk9SIChTdGF0dXMpICYmIFJl dHJpZXMrKyA8IE1BWF9SQU5ET01fUFJPQ0VTU09SX1JFVFJJRVMpOw0KKw0KKyAgaWYgKEVGSV9F UlJPUiAoU3RhdHVzKSkgew0KKyAgICByZXR1cm47DQorICB9DQorDQorICBQcmludCAoDQorICAg IEwiU3RhcnR1cFRoaXNBUCBvbiBQcm9jZXNzb3IgJWQgd2l0aCAwIChpbmZpbml0ZSkgdGltZW91 dC4uLiIsDQorICAgIFByb2Nlc3NvckluZGV4DQorICAgICk7DQorDQorICBTdGF0dXMgPSBNcC0+ U3RhcnR1cFRoaXNBUCAoDQorICAgICAgICAgICAgICAgICBNcCwNCisgICAgICAgICAgICAgICAg IEFwRnVuY3Rpb24sDQorICAgICAgICAgICAgICAgICBQcm9jZXNzb3JJbmRleCwNCisgICAgICAg ICAgICAgICAgIE5VTEwsDQorICAgICAgICAgICAgICAgICBJTkZJTklURV9USU1FT1VULA0KKyAg ICAgICAgICAgICAgICAgTlVMTCwNCisgICAgICAgICAgICAgICAgIE5VTEwNCisgICAgICAgICAg ICAgICAgICk7DQorDQorICBpZiAoRUZJX0VSUk9SIChTdGF0dXMpKSB7DQorICAgIFByaW50IChM ImZhaWxlZDogJXJcbiIsIFN0YXR1cyk7DQorICAgIHJldHVybjsNCisgIH0gZWxzZSB7DQorICAg IFByaW50IChMImRvbmUuXG4iKTsNCisgIH0NCisNCisgIFJldHJpZXMgPSAwOw0KKw0KKyAgZG8g ew0KKyAgICBTdGF0dXMgPSBHZXRSYW5kb21FbmFibGVkUHJvY2Vzc29ySW5kZXggKE1wLCAmUHJv Y2Vzc29ySW5kZXgpOw0KKyAgfSB3aGlsZSAoRUZJX0VSUk9SIChTdGF0dXMpICYmIFJldHJpZXMr KyA8IE1BWF9SQU5ET01fUFJPQ0VTU09SX1JFVFJJRVMpOw0KKw0KKyAgaWYgKEVGSV9FUlJPUiAo U3RhdHVzKSkgew0KKyAgICByZXR1cm47DQorICB9DQorDQorICBQcmludCAoDQorICAgIEwiU3Rh cnR1cFRoaXNBUCBvbiBQcm9jZXNzb3IgJWQgd2l0aCAlZG1zIHRpbWVvdXQuLi4iLA0KKyAgICBQ cm9jZXNzb3JJbmRleCwNCisgICAgQVBfU1RBUlRVUF9URVNUX1RJTUVPVVRfVVMgLyAxMDAwDQor ICAgICk7DQorICBTdGF0dXMgPSBNcC0+U3RhcnR1cFRoaXNBUCAoDQorICAgICAgICAgICAgICAg ICBNcCwNCisgICAgICAgICAgICAgICAgIEFwRnVuY3Rpb24sDQorICAgICAgICAgICAgICAgICBQ cm9jZXNzb3JJbmRleCwNCisgICAgICAgICAgICAgICAgIE5VTEwsDQorICAgICAgICAgICAgICAg ICBBUF9TVEFSVFVQX1RFU1RfVElNRU9VVF9VUywNCisgICAgICAgICAgICAgICAgIE5VTEwsDQor ICAgICAgICAgICAgICAgICBOVUxMDQorICAgICAgICAgICAgICAgICApOw0KKyAgaWYgKEVGSV9F UlJPUiAoU3RhdHVzKSkgew0KKyAgICBQcmludCAoTCJmYWlsZWQ6ICVyXG4iLCBTdGF0dXMpOw0K KyAgICByZXR1cm47DQorICB9IGVsc2Ugew0KKyAgICBQcmludCAoTCJkb25lLlxuIik7DQorICB9 DQorfQ0KKw0KKy8qKiBUZXN0cyBmb3IgdGhlIFN0YXJ0dXBBbGxBUHMgZnVuY3Rpb24uDQorDQor ICBAcGFyYW0gTXAgICAgICBUaGUgTVAgU2VydmljZXMgUHJvdG9jb2wuDQorICBAcGFyYW0gTnVt Q3B1cyBUaGUgbnVtYmVyIG9mIENQVXMgaW4gdGhlIHN5c3RlbS4NCisNCisqKi8NCitTVEFUSUMN CitWT0lEDQorU3RhcnR1cEFsbEFQc1Rlc3RzICgNCisgIElOIEVGSV9NUF9TRVJWSUNFU19QUk9U T0NPTCAgKk1wLA0KKyAgSU4gVUlOVE4gICAgICAgICAgICAgICAgICAgICBOdW1DcHVzDQorICAp DQorew0KKyAgRUZJX1NUQVRVUyAgU3RhdHVzOw0KKyAgVUlOVE4gICAgICAgVGltZW91dDsNCisN CisgIFByaW50IChMIlJ1bm5pbmcgd2l0aCBTaW5nbGVUaHJlYWQgRkFMU0UsIDAgKGluZmluaXRl KSB0aW1lb3V0Li4uIik7DQorICBTdGF0dXMgPSBNcC0+U3RhcnR1cEFsbEFQcyAoTXAsIEFwRnVu Y3Rpb24sIEZBTFNFLCBOVUxMLCBJTkZJTklURV9USU1FT1VULCBOVUxMLCBOVUxMKTsNCisgIGlm IChFRklfRVJST1IgKFN0YXR1cykpIHsNCisgICAgUHJpbnQgKEwiZmFpbGVkOiAlclxuIiwgU3Rh dHVzKTsNCisgICAgcmV0dXJuOw0KKyAgfSBlbHNlIHsNCisgICAgUHJpbnQgKEwiZG9uZS5cbiIp Ow0KKyAgfQ0KKw0KKyAgVGltZW91dCA9IE51bUNwdXMgKiBBUF9TVEFSVFVQX1RFU1RfVElNRU9V VF9VUzsNCisNCisgIFByaW50IChMIlJ1bm5pbmcgd2l0aCBTaW5nbGVUaHJlYWQgVFJVRSwgJWRt cyB0aW1lb3V0Li4uIiwgVGltZW91dCAvIDEwMDApOw0KKyAgU3RhdHVzID0gTXAtPlN0YXJ0dXBB bGxBUHMgKA0KKyAgICAgICAgICAgICAgICAgTXAsDQorICAgICAgICAgICAgICAgICBBcEZ1bmN0 aW9uLA0KKyAgICAgICAgICAgICAgICAgVFJVRSwNCisgICAgICAgICAgICAgICAgIE5VTEwsDQor ICAgICAgICAgICAgICAgICBUaW1lb3V0LA0KKyAgICAgICAgICAgICAgICAgTlVMTCwNCisgICAg ICAgICAgICAgICAgIE5VTEwNCisgICAgICAgICAgICAgICAgICk7DQorICBpZiAoRUZJX0VSUk9S IChTdGF0dXMpKSB7DQorICAgIFByaW50I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IGVudHJ5IHBvaW50Lg0KKw0KKyoqLw0KK0VGSV9TVEFUVVMNCitFRklBUEkNCitV ZWZpTWFpbiAoDQorICBJTiBFRklfSEFORExFICAgICAgICBJbWFnZUhhbmRsZSwNCisgIElOIEVG SV9TWVNURU1fVEFCTEUgICpTeXN0ZW1UYWJsZQ0KKyAgKQ0KK3sNCisgIEVGSV9TVEFUVVMgICAg ICAgICAgICAgICAgU3RhdHVzOw0KKyAgRUZJX01QX1NFUlZJQ0VTX1BST1RPQ09MICAqTXA7DQor ICBFRklfSEFORExFICAgICAgICAgICAgICAgICpwSGFuZGxlOw0KKyAgVUlOVE4gICAgICAgICAg ICAgICAgICAgICBIYW5kbGVDb3VudDsNCisgIFVJTlROICAgICAgICAgICAgICAgICAgICAgQnNw SWQ7DQorICBVSU5UTiAgICAgICAgICAgICAgICAgICAgIE51bUNwdXM7DQorICBVSU5UTiAgICAg ICAgICAgICAgICAgICAgIEluZGV4Ow0KKw0KKyAgcEhhbmRsZSAgICAgPSBOVUxMOw0KKyAgSGFu ZGxlQ291bnQgPSAwOw0KKyAgQnNwSWQgICAgICAgPSAwOw0KKw0KKyAgU3RhdHVzID0gZ0JTLT5M b2NhdGVIYW5kbGVCdWZmZXIgKA0KKyAgICAgICAgICAgICAgICAgIEJ5UHJvdG9jb2wsDQorICAg ICAgICAgICAgICAgICAgJmdFZmlNcFNlcnZpY2VQcm90b2NvbEd1aWQsDQorICAgICAgICAgICAg ICAgICAgTlVMTCwNCisgICAgICAgICAgICAgICAgICAmSGFuZGxlQ291bnQsDQorICAgICAgICAg ICAgICAgICAgJnBIYW5kbGUNCisgICAgICAgICAgICAgICAgICApOw0KKw0KKyAgaWYgKEVGSV9F UlJPUiAoU3RhdHVzKSkgew0KKyAgICBQcmludCAoTCJGYWlsZWQgdG8gbG9jYXRlIEVGSV9NUF9T RVJWSUNFU19QUk9UT0NPTCAoJXIpLiBOb3QgaW5zdGFsbGVkIG9uIHBsYXRmb3JtP1xuIiwgU3Rh dHVzKTsNCisgICAgcmV0dXJuIEVGSV9OT1RfRk9VTkQ7DQorICB9DQorDQorICBmb3IgKEluZGV4 ID0gMDsgSW5kZXggPCBIYW5kbGVDb3VudDsgSW5kZXgrKykgew0KKyAgICBTdGF0dXMgPSBnQlMt Pk9wZW5Qcm90b2NvbCAoDQorICAgICAgICAgICAgICAgICAgICAqcEhhbmRsZSwNCisgICAgICAg ICAgICAgICAgICAgICZnRWZpTXBTZXJ2aWNlUHJvdG9jb2xHdWlkLA0KKyAgICAgICAgICAgICAg ICAgICAgKFZPSUQgKiopJk1wLA0KKyAgICAgICAgICAgICAgICAgICAgTlVMTCwNCisgICAgICAg ICAgICAgICAgICAgIGdJbWFnZUhhbmRsZSwNCisgICAgICAgICAgICAgICAgICAgIEVGSV9PUEVO X1BST1RPQ09MX0dFVF9QUk9UT0NPTA0KKyAgICAgICAgICAgICAgICAgICAgKTsNCisNCisgICAg aWYgKEVGSV9FUlJPUiAoU3RhdHVzKSkgew0KKyAgICAgIHJldHVybiBTdGF0dXM7DQorICAgIH0N CisNCisgICAgcEhhbmRsZSsrOw0KKyAgfQ0KKw0KKyAgUHJpbnQgKEwiRXhlcmNpc2luZyBXaG9B bUlcblxuIik7DQorICBTdGF0dXMgPSBNcC0+V2hvQW1JIChNcCwgJkJzcElkKTsNCisgIGlmIChF RklfRVJST1IgKFN0YXR1cykpIHsNCisgICAgUHJpbnQgKEwiV2hvQW1JIGZhaWxlZDogJXJcbiIs IFN0YXR1cyk7DQorICAgIHJldHVybiBTdGF0dXM7DQorICB9IGVsc2Ugew0KKyAgICBQcmludCAo TCJXaG9BbUk6ICUwMTZseFxuIiwgQnNwSWQpOw0KKyAgfQ0KKw0KKyAgUHJpbnQgKEwiXG4iKTsN CisgIFByaW50ICgNCisgICAgTCJFeGVyY2lzaW5nIEdldE51bWJlck9mUHJvY2Vzc29ycyBhbmQg R2V0UHJvY2Vzc29ySW5mb3JtYXRpb24gd2l0aCAiDQorICAgIEwiQ1BVX1YyX0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wZDhmYQ0KLS0tIC9kZXYvbnVsbA0KKysrIGIvTWRlTW9kdWxlUGtnL0FwcGxpY2F0 aW9uL01wU2VydmljZXNUZXN0L01wU2VydmljZXNUZXN0LmluZg0KQEAgLTAsMCArMSwzOCBAQA0K KyMjIEBmaWxlDQorIyAgVUVGSSBBcHBsaWNhdGlvbiB0byBleGVyY2lzZSBFRklfTVBfU0VSVklD RVNfUFJPVE9DT0wuDQorIw0KKyMgIENvcHlyaWdodCAoYykgMjAyMSwgTlVWSUEgSW5jLiBBbGwg cmlnaHRzIHJlc2VydmVkLjxCUj4NCisjDQorIyAgU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IEJT RC0yLUNsYXVzZS1QYXRlbnQNCisjDQorIyMNCisNCitbRGVmaW5lc10NCisgIElORl9WRVJTSU9O ICAgICAgICAgICAgICAgICAgICA9IDEuMjkNCisgIEJBU0VfTkFNRSAgICAgICAgICAgICAgICAg ICAgICA9IE1wU2VydmljZXNUZXN0DQorICBGSUxFX0dVSUQgICAgICAgICAgICAgICAgICAgICAg PSA0M2U5ZGVmYS03MjA5LTRiMGQtYjEzNi1jYzRjYTAyY2I0NjkNCisgIE1PRFVMRV9UWVBFICAg ICAgICAgICAgICAgICAgICA9IFVFRklfQVBQTElDQVRJT04NCisgIFZFUlNJT05fU1RSSU5HICAg ICAgICAgICAgICAgICA9IDAuMQ0KKyAgRU5UUllfUE9JTlQgICAgICAgICAgICAgICAgICAgID0g VWVmaU1haW4NCisNCisjDQorIyBUaGUgZm9sbG93aW5nIGluZm9ybWF0aW9uIGlzIGZvciByZWZl cmVuY2Ugb25seSBhbmQgbm90IHJlcXVpcmVkIGJ5IHRoZSBidWlsZCB0b29scy4NCisjDQorIyAg VkFMSURfQVJDSElURUNUVVJFUyAgICAgICAgICAgPSBJQTMyIFg2NCBBQVJDSDY0DQorIw0KKw0K K1tTb3VyY2VzXQ0KKyAgTXBTZXJ2aWNlc1Rlc3QuYw0KKw0KK1tQYWNrYWdlc10NCis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Niw3IEBADQogICBNZGVNb2R1 bGVQa2cvQXBwbGljYXRpb24vSGVsbG9Xb3JsZC9IZWxsb1dvcmxkLmluZg0KICAgTWRlTW9kdWxl UGtnL0FwcGxpY2F0aW9uL0R1bXBEeW5QY2QvRHVtcER5blBjZC5pbmYNCiAgIE1kZU1vZHVsZVBr Zy9BcHBsaWNhdGlvbi9NZW1vcnlQcm9maWxlSW5mby9NZW1vcnlQcm9maWxlSW5mby5pbmYNCisg IE1kZU1vZHVsZVBrZy9BcHBsaWNhdGlvbi9NcFNlcnZpY2VzVGVzdC9NcFNlcnZpY2VzVGVzdC5p bmYNCiAgIE1kZU1vZHVsZVBrZy9MaWJyYXJ5L1VlZmlTb3J0TGliL1VlZmlTb3J0TGliLmluZg0K ICAgTWRlTW9kdWxlUGtnL0xvZ28vTG9nby5pbmYNCi0tIA0KMi4zMS4xDQogDQogDQogDQoNCiAN CiANCiANCg== ------=_001_NextPart673081615726_=---- Content-Type: text/html; charset="GB2312" Content-Transfer-Encoding: quoted-printable
Hi=A3=ACRebecca

I'd like to give= two comments on this patch.

1,  I don't think there are more than o= ne MP services instances installed reuirement on one system.  X86 plat= form installed one MP service instance even on mutiple-sockets system. = ;
  &n= bsp; For ARM platform, is there any requirement to handle multple MP servic= es instance?
2,&n= bsp; AP function is NULL implementation that could not make sure BSP recongized if APs run = indeed.  You could simply update AP function to use one=  global variable seamphoere wrapped by lock protections= .
&nbs= p;   I think&nbs= p;this patch is very good start to add MP test app in open source world.&nb= sp; This comment is only sugestion for your next plan. :-)

Best Regards,
<= div>Jeff
 
From:=  Rebecca Cran
Date: 2021-12-13 02:08
To: devel; Ard Biesheuvel; Gerd Hof= fmann; Samer El-Haj-Mah= moud; Leif Lindholm; Jian J Wang; Liming Gao; nd; <= a href=3D"mailto:sami.mujawar@arm.com">Sami Mujawar
<= b>Subject: [edk2-devel] [PATCH v4 1/1] MdeModulePkg: Add MpService= sTest application to exercise MP Services
Add a = new MpServicesTest application under MdeModulePkg/Application that
exercises the EFI_MP_SERVICES_PROTOCOL.
 
Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---
MdeModulePkg/Application/MpServicesTest/MpServicesTest.c   = | 422 ++++++++++++++++++++
MdeModulePkg/Application/MpServicesTest/MpServicesTest.inf |  38= ++
MdeModulePkg/MdeModulePkg.dsc      &nbs= p;            &= nbsp;          |   2= +
3 files changed, 462 insertions(+)
 
diff --git a/MdeModulePkg/Application/MpServicesTest/MpServicesTest.c = b/MdeModulePkg/Application/MpServicesTest/MpServicesTest.c
new file mode 100644
index 000000000000..933813e19e05
--- /dev/null
+++ b/MdeModulePkg/Application/MpServicesTest/MpServicesTest.c
@@ -0,0 +1,422 @@
+/** @file
+
+    Copyright (c) 2021, NUVIA Inc. All rights reserved= .<BR>
+    SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Uefi.h>
+#include <Library/DebugLib.h>
+#include <Library/RngLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Pi/PiMultiPhase.h>
+#include <Protocol/MpService.h>
+
+#define MAX_RANDOM_PROCESSOR_RETRIES  10
+
+#define AP_STARTUP_TEST_TIMEOUT_US  50000
+#define INFINITE_TIMEOUT       &nb= sp;    0
+
+/** The procedure to run with the MP Services interface.
+
+  @param Buffer The procedure argument.
+
+**/
+STATIC
+VOID
+EFIAPI
+ApFunction (
+  IN OUT VOID  *Buffer
+  )
+{
+}
+
+/** Displays information returned from MP Services Protocol.
+
+  @param Mp  The MP Services Protocol
+
+  @return The number of CPUs in the system.
+
+**/
+STATIC
+UINTN
+PrintProcessorInformation (
+  IN EFI_MP_SERVICES_PROTOCOL  *Mp
+  )
+{
+  EFI_STATUS        &nbs= p;        Status;
+  EFI_PROCESSOR_INFORMATION  CpuInfo;
+  UINTN         &nb= sp;            Index= ;
+  UINTN         &nb= sp;            NumCp= u;
+  UINTN         &nb= sp;            NumEn= abledCpu;
+
+  Status =3D Mp->GetNumberOfProcessors (Mp, &NumCpu, &= ;NumEnabledCpu);
+  if (EFI_ERROR (Status)) {
+    Print (L"GetNumberOfProcessors failed: %r\n", Stat= us);
+  } else {
+    Print (L"Number of CPUs: %ld, Enabled: %d\n", NumC= pu, NumEnabledCpu);
+  }
+
+  for (Index =3D 0; Index < NumCpu; Index++) {
+    Status =3D Mp->GetProcessorInfo (Mp, CPU_V2_EXT= ENDED_TOPOLOGY | Index, &CpuInfo);
+    if (EFI_ERROR (Status)) {
+      Print (L"GetProcessorInfo for Processo= r %d failed: %r\n", Index, Status);
+    } else {
+      Print (
+        L"Processor %d:\n"
+        L"\tID: %016lx\n"
+        L"\tStatus: %s | ",
+        Index,
+        CpuInfo.ProcessorId,
+        (CpuInfo.StatusFlag & = PROCESSOR_AS_BSP_BIT) ? L"BSP" : L"AP"
+        );
+
+      Print (L"%s | ", (CpuInfo.StatusFlag &= amp; PROCESSOR_ENABLED_BIT) ? L"Enabled" : L"Disabled");
+      Print (L"%s\n", (CpuInfo.StatusFlag &a= mp; PROCESSOR_HEALTH_STATUS_BIT) ? L"Healthy" : L"Faulted");
+
+      Print (
+        L"\tLocation: Package %d, = Core %d, Thread %d\n"
+        L"\tExtended Information: = Package %d, Module %d, Tile %d, Die %d, Core %d, Thread %d\n\n",
+        CpuInfo.Location.Package,<= /div>
+        CpuInfo.Location.Core,
+        CpuInfo.Location.Thread,
+        CpuInfo.ExtendedInformatio= n.Location2.Package,
+        CpuInfo.ExtendedInformatio= n.Location2.Module,
+        CpuInfo.ExtendedInformatio= n.Location2.Tile,
+        CpuInfo.ExtendedInformatio= n.Location2.Die,
+        CpuInfo.ExtendedInformatio= n.Location2.Core,
+        CpuInfo.ExtendedInformatio= n.Location2.Thread
+        );
+    }
+  }
+
+  return NumCpu;
+}
+
+/** Returns the index of an enabled AP selected at random.
+
+  @param Mp         = ;    The MP Services Protocol.
+  @param ProcessorIndex The index of a random enabled AP.
+
+  @retval EFI_SUCCESS   An enabled processor was found= and returned.
+  @retval EFI_NOT_FOUND A processor was unable to be selected.
+
+**/
+STATIC
+EFI_STATUS
+GetRandomEnabledProcessorIndex (
+  IN EFI_MP_SERVICES_PROTOCOL  *Mp,
+  OUT UINTN         = ;           *ProcessorInd= ex
+  )
+{
+  UINTN         &nb= sp;            Index= ;
+  UINTN         &nb= sp;            Index= OfEnabledCpu;
+  UINTN         &nb= sp;            NumCp= us;
+  UINTN         &nb= sp;            NumEn= abledCpus;
+  UINTN         &nb= sp;            Index= OfEnabledCpuToUse;
+  UINT16         &n= bsp;           RandomNumb= er;
+  BOOLEAN         &= nbsp;          Success;
+  EFI_STATUS        &nbs= p;        Status;
+  EFI_PROCESSOR_INFORMATION  CpuInfo;
+
+  IndexOfEnabledCpu =3D 0;
+
+  Success =3D GetRandomNumber16 (&RandomNumber);
+  ASSERT (Success =3D=3D TRUE);
+
+  Status =3D Mp->GetNumberOfProcessors (Mp, &NumCpus, &am= p;NumEnabledCpus);
+  ASSERT_EFI_ERROR (Status);
+
+  if (NumEnabledCpus =3D=3D 1) {
+    Print (L"All APs are disabled\n");
+    return EFI_NOT_FOUND;
+  }
+
+  IndexOfEnabledCpuToUse =3D RandomNumber % NumEnabledCpus;
+
+  for (Index =3D 0; Index < NumCpus; Index++) {
+    Status =3D Mp->GetProcessorInfo (Mp, Index, &am= p;CpuInfo);
+    ASSERT_EFI_ERROR (Status);
+    if ((CpuInfo.StatusFlag & PROCESSOR_ENABLED_BI= T) &&
+        !(CpuInfo.StatusFlag &= PROCESSOR_AS_BSP_BIT))
+    {
+      if (IndexOfEnabledCpuToUse =3D=3D Inde= xOfEnabledCpu) {
+        *ProcessorIndex =3D Index;=
+        Status   &n= bsp;      =3D EFI_SUCCESS;
+        break;
+      }
+
+      IndexOfEnabledCpu++;
+    }
+  }
+
+  if (Index =3D=3D NumCpus) {
+    Status =3D EFI_NOT_FOUND;
+  }
+
+  return Status;
+}
+
+/** Tests for the StartupThisAP function.
+
+  @param Mp The MP Services Protocol.
+
+**/
+STATIC
+VOID
+StartupThisApTests (
+  IN EFI_MP_SERVICES_PROTOCOL  *Mp
+  )
+{
+  EFI_STATUS  Status;
+  UINTN       ProcessorIndex;
+  UINT32      Retries;
+
+  Retries =3D 0;
+
+  do {
+    Status =3D GetRandomEnabledProcessorIndex (Mp, &am= p;ProcessorIndex);
+  } while (EFI_ERROR (Status) && Retries++ < MAX_RAND= OM_PROCESSOR_RETRIES);
+
+  if (EFI_ERROR (Status)) {
+    return;
+  }
+
+  Print (
+    L"StartupThisAP on Processor %d with 0 (infinite) = timeout...",
+    ProcessorIndex
+    );
+
+  Status =3D Mp->StartupThisAP (
+           &nb= sp;     Mp,
+           &nb= sp;     ApFunction,
+           &nb= sp;     ProcessorIndex,
+           &nb= sp;     NULL,
+           &nb= sp;     INFINITE_TIMEOUT,
+           &nb= sp;     NULL,
+           &nb= sp;     NULL
+           &nb= sp;     );
+
+  if (EFI_ERROR (Status)) {
+    Print (L"failed: %r\n", Status);
+    return;
+  } else {
+    Print (L"done.\n");
+  }
+
+  Retries =3D 0;
+
+  do {
+    Status =3D GetRandomEnabledProcessorIndex (Mp, &am= p;ProcessorIndex);
+  } while (EFI_ERROR (Status) && Retries++ < MAX_RAND= OM_PROCESSOR_RETRIES);
+
+  if (EFI_ERROR (Status)) {
+    return;
+  }
+
+  Print (
+    L"StartupThisAP on Processor %d with %dms timeout.= ..",
+    ProcessorIndex,
+    AP_STARTUP_TEST_TIMEOUT_US / 1000
+    );
+  Status =3D Mp->StartupThisAP (
+           &nb= sp;     Mp,
+           &nb= sp;     ApFunction,
+           &nb= sp;     ProcessorIndex,
+           &nb= sp;     NULL,
+           &nb= sp;     AP_STARTUP_TEST_TIMEOUT_US,
+           &nb= sp;     NULL,
+           &nb= sp;     NULL
+           &nb= sp;     );
+  if (EFI_ERROR (Status)) {
+    Print (L"failed: %r\n", Status);
+    return;
+  } else {
+    Print (L"done.\n");
+  }
+}
+
+/** Tests for the StartupAllAPs function.
+
+  @param Mp      The MP Services Protoc= ol.
+  @param NumCpus The number of CPUs in the system.
+
+**/
+STATIC
+VOID
+StartupAllAPsTests (
+  IN EFI_MP_SERVICES_PROTOCOL  *Mp,
+  IN UINTN         =             NumCpus<= /div>
+  )
+{
+  EFI_STATUS  Status;
+  UINTN       Timeout;
+
+  Print (L"Running with SingleThread FALSE, 0 (infinite) timeout= ...");
+  Status =3D Mp->StartupAllAPs (Mp, ApFunction, FALSE, NULL, = INFINITE_TIMEOUT, NULL, NULL);
+  if (EFI_ERROR (Status)) {
+    Print (L"failed: %r\n", Status);
+    return;
+  } else {
+    Print (L"done.\n");
+  }
+
+  Timeout =3D NumCpus * AP_STARTUP_TEST_TIMEOUT_US;
+
+  Print (L"Running with SingleThread TRUE, %dms timeout...", Tim= eout / 1000);
+  Status =3D Mp->StartupAllAPs (
+           &nb= sp;     Mp,
+           &nb= sp;     ApFunction,
+           &nb= sp;     TRUE,
+           &nb= sp;     NULL,
+           &nb= sp;     Timeout,
+           &nb= sp;     NULL,
+           &nb= sp;     NULL
+           &nb= sp;     );
+  if (EFI_ERROR (Status)) {
+    Print (L"failed: %r\n", Status);
+    return;
+  } else {
+    Print (L"done.\n");
+  }
+}
+
+/** Tests for the EnableDisableAP function.
+
+  @param Mp      The MP Services Protoc= ol.
+  @param NumCpus The number of CPUs in the system.
+
+**/
+STATIC
+VOID
+EnableDisableAPTests (
+  IN EFI_MP_SERVICES_PROTOCOL  *Mp,
+  IN UINTN         =             NumCpus<= /div>
+  )
+{
+  EFI_STATUS  Status;
+  UINTN       Index;
+  UINT32      HealthFlag;
+
+  HealthFlag =3D 0;
+
+  for (Index =3D 1; Index < NumCpus; Index++) {
+    Print (L"Disabling Processor %d with HealthFlag fa= ulted...", Index);
+    Status =3D Mp->EnableDisableAP (Mp, Index, FALS= E, &HealthFlag);
+    if (EFI_ERROR (Status)) {
+      Print (L"failed: %r\n", Status);
+      return;
+    } else {
+      Print (L"done.\n");
+    }
+  }
+
+  HealthFlag =3D PROCESSOR_HEALTH_STATUS_BIT;
+
+  for (Index =3D 1; Index < NumCpus; Index++) {
+    Print (L"Enabling Processor %d with HealthFlag hea= lthy...", Index);
+    Status =3D Mp->EnableDisableAP (Mp, Index, TRUE= , &HealthFlag);
+    if (EFI_ERROR (Status)) {
+      Print (L"failed: %r\n", Status);
+      return;
+    } else {
+      Print (L"done.\n");
+    }
+  }
+}
+
+/**
+  The user Entry Point for Application. The user code starts wit= h this function
+  as the real entry point for the application.
+
+  @param[in] ImageHandle    The firmware allocate= d handle for the EFI image.
+  @param[in] SystemTable    A pointer to the EFI = System Table.
+
+  @retval EFI_SUCCESS       The en= try point is executed successfully.
+  @retval other        &= nbsp;    Some error occurs when executing this entry point.<= /div>
+
+**/
+EFI_STATUS
+EFIAPI
+UefiMain (
+  IN EFI_HANDLE        ImageH= andle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS        &nbs= p;       Status;
+  EFI_MP_SERVICES_PROTOCOL  *Mp;
+  EFI_HANDLE        &nbs= p;       *pHandle;
+  UINTN         &nb= sp;           HandleCount= ;
+  UINTN         &nb= sp;           BspId;
+  UINTN         &nb= sp;           NumCpus;
+  UINTN         &nb= sp;           Index;
+
+  pHandle     =3D NULL;
+  HandleCount =3D 0;
+  BspId       =3D 0;
+
+  Status =3D gBS->LocateHandleBuffer (
+           &nb= sp;      ByProtocol,
+           &nb= sp;      &gEfiMpServiceProtocolGuid,
+           &nb= sp;      NULL,
+           &nb= sp;      &HandleCount,
+           &nb= sp;      &pHandle
+           &nb= sp;      );
+
+  if (EFI_ERROR (Status)) {
+    Print (L"Failed to locate EFI_MP_SERVICES_PROTOCOL= (%r). Not installed on platform?\n", Status);
+    return EFI_NOT_FOUND;
+  }
+
+  for (Index =3D 0; Index < HandleCount; Index++) {
+    Status =3D gBS->OpenProtocol (
+           &nb= sp;        *pHandle,
+           &nb= sp;        &gEfiMpServiceProtocolGui= d,
+           &nb= sp;        (VOID **)&Mp,
+           &nb= sp;        NULL,
+           &nb= sp;        gImageHandle,
+           &nb= sp;        EFI_OPEN_PROTOCOL_GET_PROTOCO= L
+           &nb= sp;        );
+
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    pHandle++;
+  }
+
+  Pri= nt (L"Exercising WhoAmI\n\n");
+  Status =3D Mp->WhoAmI (Mp, &BspId);
+  if (EFI_ERROR (Status)) {
+    Print (L"WhoAmI failed: %r\n", Status);
+    return Status;
+  } else {
+    Print (L"WhoAmI: %016lx\n", BspId);
+  }
+
+  Print (L"\n");
+  Print (
+    L"Exercising GetNumberOfProcessors and GetProcesso= rInformation with "
+    L"CPU_V2_EXTENDED_TOPOLOGY\n\n"
+    );
+  NumCpus =3D PrintProcessorInformation (Mp);
+  if (NumCpus < 2) {
+    Print (L"UP system found. Not running further test= s.\n");
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Print (L"\n");
+  Print (L"Exercising StartupThisAP:\n\n");
+  StartupThisApTests (Mp);
+
+  Print (L"\n");
+  Print (L"Exercising StartupAllAPs:\n\n");
+  StartupAllAPsTests (Mp, NumCpus);
+
+  Print (L"\n");
+  Print (L"Exercising EnableDisableAP:\n\n");
+  EnableDisableAPTests (Mp, NumCpus);
+
+  gBS->CloseProtocol (pHandle, &gEfiMpServiceProtocolGuid= , gImageHandle, NULL);
+  return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Application/MpServicesTest/MpServicesTest.in= f b/MdeModulePkg/Application/MpServicesTest/MpServicesTest.inf
new file mode 100644
index 000000000000..8a21ca70d8fa
--- /dev/null
+++ b/MdeModulePkg/Application/MpServicesTest/MpServicesTest.inf
@@ -0,0 +1,38 @@
+## @file
+#  UEFI Application to exercise EFI_MP_SERVICES_PROTOCOL.
+#
+#  Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>=
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION        &nb= sp;           =3D 1.29
+  BASE_NAME         = ;             = =3D MpServicesTest
+  FILE_GUID         = ;             = =3D 43e9defa-7209-4b0d-b136-cc4ca02cb469
+  MODULE_TYPE        &nb= sp;           =3D UEFI_AP= PLICATION
+  VERSION_STRING        =          =3D 0.1
+  ENTRY_POINT        &nb= sp;           =3D UefiMai= n
+
+#
+# The following information is for reference only and not required by= the build tools.
+#
+#  VALID_ARCHITECTURES       =     =3D IA32 X64 AARCH64
+#
+
+[Sources]
+  MpServicesTest.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseLib
+  RngLib
+  UefiApplicationEntryPoint
+  UefiLib
+
+[Protocols]
+  gEfiMpServiceProtocolGuid    ## CONSUMES
+
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg= .dsc
index b1d83461865e..1cf5ccd30d40 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -164,6 +164,7 @@
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLi= b/UefiMemoryAllocationLib.inf
   DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibSt= dErr.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHa= ndleLib.inf
+  RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
[LibraryClasses.common.MM_STANDALONE]
   HobLib|MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull= .inf
@@ -215,6 +216,7 @@
   MdeModulePkg/Application/HelloWorld/HelloWorld.inf
   MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.inf
   MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileI= nfo.inf
+  MdeModulePkg/Application/MpServicesTest/MpServicesTest.inf
   MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   MdeModulePkg/Logo/Logo.inf
--
2.31.1
 
 
 
 
 
 
------=_001_NextPart673081615726_=------