Ashish, Thanks for the pointer. I agree there is an issue here.
Please enter a Bugzilla against the IScsiDxe module for this issue so we can fix this failure. You are also welcome to enter a Bugzilla for a feature request to add UefiLib APIs that can be used to safely uninstall all the driver model related protocol that can be used in error paths in the entry point and in unload handlers. Thanks, Mike From: Ashish Singhal [mailto:ashishsin...@nvidia.com] Sent: Thursday, January 3, 2019 4:16 PM To: Kinney, Michael D <michael.d.kin...@intel.com>; edk2-devel@lists.01.org Cc: Gao, Liming <liming....@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Wu, Jiaxin <jiaxin...@intel.com> Subject: RE: Uninstalling Invalid Protocol Interfaces Hi Mike, Call to UninstallMultipleProtocolInterfaces at https://github.com/tianocore/edk2/blob/master/NetworkPkg/IScsiDxe/IScsiDriver.c#L1864 fails because the component name interface may not be installed depending on the state of PCD. Thanks Ashish From: Kinney, Michael D <michael.d.kin...@intel.com<mailto:michael.d.kin...@intel.com>> Sent: Thursday, January 3, 2019 5:09 PM To: Ashish Singhal <ashishsin...@nvidia.com<mailto:ashishsin...@nvidia.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Kinney, Michael D <michael.d.kin...@intel.com<mailto:michael.d.kin...@intel.com>> Cc: Gao, Liming <liming....@intel.com<mailto:liming....@intel.com>>; Fu, Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>>; Wu, Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> Subject: RE: Uninstalling Invalid Protocol Interfaces Hi Ashish, Can you provide a pointer to the UninstallMultipleProtocolInterfaces() call that is causing this failure? I agree that the UefiLib could provide additional services to simplify the implementation of the unload handlers. Matching the UefiLib APIs that install the Uefi Driver Model protocol would be useful, so the driver entry point and the driver unload functions can use matching APIs. Mike From: Ashish Singhal [mailto:ashishsin...@nvidia.com] Sent: Thursday, January 3, 2019 3:39 PM To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org> Cc: Kinney, Michael D <michael.d.kin...@intel.com<mailto:michael.d.kin...@intel.com>>; Gao, Liming <liming....@intel.com<mailto:liming....@intel.com>>; Fu, Siyuan <siyuan...@intel.com<mailto:siyuan...@intel.com>>; Wu, Jiaxin <jiaxin...@intel.com<mailto:jiaxin...@intel.com>> Subject: Uninstalling Invalid Protocol Interfaces Hello, As part of moving from MdeModulePkg implementation of IScsiDxe to the implementation in NetworkPkg, I started hitting exception in the driver loaded after IScsiDxe if IScsiDxe's installation fails for some reason. Upon debugging, I found out that calls to UninstallMultipleProtocolInterfaces as part of Error 2 as well Error 1 fail while trying to uninstall component name protocol-interface pair and return error code EFI_INVALID_PARAMETER. As per UninstallMultipleProtocolInterfaces's documentation, if uninstallation of any of the input protocol-interface pair fails, it will reinstall any just uninstalled protocol and return EFI_INVALID_PARAMETER which causes the cleanup of this driver corrupt leading to failure in next driver getting loaded. The reason of failure in UninstallMultipleProtocolInterfaces is because the driver uses EfiLibInstallDriverBindingComponentName2 to install interfaces which may not install component name interfaces depending on the value of PCDs PcdComponentNameDi sable and PcdComponentName2Disable. I have the following proposals to get around this issue. 1. Instead of calling UninstallMultipleProtocolInterfaces once and list all protocol-interface pairs, do it sequentially for every pair so that the once which was installed correctly, gets uninstalled instead of getting reinstalled because of a failure uninstalling another pair. This would however make us not really use use UninstallMultipleProtocolInterfaces API to its full caliber. 2. In UEFILib, add a function EfiLibUninstallDriverBindingComponentName2 for uninstalling protocol interfaces taking into consideration the state of PCDs PcdComponentNameDisable and PcdComponentName2Disable. 3. In UEFILib, add uninstall functions for all corresponding install APIs to get coverage for all scenarios. I would certainly prefer option 2 or 3 as they seem to be more correct and would provide a for all drivers which may hit the issue. I am happy to make the code changes as needed and suggested by the maintainers. Thanks Ashish ________________________________ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ________________________________ _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel