Hi, Andrew
Yes, the current FlushBlockEx() implementation in AtaBustDriver doesn't finish
all tasks which have been transferred to it. It is a bug.
But it won't overwrite freed memory since AtaBusDriver maintain its own subtask
list.
The issues related to this bug could be 1. Because the Token.evnt has been
signaled, after task has been truly finished, the Callback function in
AtaBusDriver will fail to signal the token again (since it might be freed)
2. Only
part of data has been write/read to/from the I/O device when the FlushBlockEx()
has been called.
For the Token set to NULL, we need further discussion with SPEC owner.
The FlushBlockEx() is not recommended to use frequently in Non-Blocking mode
since it implements in blocking way and that will definitely impact the
performance.
Thanks
Michalle
-----Original Message-----
From: Andrew Fish [mailto:[email protected]]
Sent: Sunday, September 30, 2012 1:28 AM
To: [email protected]
Subject: [edk2] MdeModulePkg EFI_BLOCK_IO2_PROTOCOL.FlushBlocksEx questions?
Dear MdeModulePkg maintainers,
I see the Partition driver doing the following in its Stop() function:
BlockIo2->FlushBlocksEx (BlockIo2, NULL);
I don't see in the UEFI spec where Token being set to NULL is defined? What
does Token == NULL mean?
In the AtaBusDriver FlushBlocksEx() seems to just signal the Token? So this
implies the caller can then free Token, and the Buffer used for the
transaction. It seems like Token and Buffer are queued by the AtaBusDriver, so
would not this cause AtaBusDriver to overwrite freed memory? Also If do a large
ReadBlocksEx(), do work, and then do a FlushBlocksEx(), it seems like my event
will be signaled that the read buffer is valid. It looks like the caller gets
signaled that the read is complete, when it may not be complete?
EFI_STATUS
EFIAPI
AtaBlockIoFlushBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
)
{
//
// Signal event and return directly.
//
if (Token != NULL && Token->Event != NULL) {
Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
return EFI_SUCCESS;
}
Andrew Fish
PS I'm doing some research for USWG on surprise hot removal and I'm trying to
figure out what the Stop() function of the consumer of BlockIo2 should do if
Async I/O is in flight. It seems like the two options are to call
FlushBlocksEx() on all pending transactions, or fail the Stop() until
transactions complete.
------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel