tools, perf: work around static compilation issues

This commit just adds to the compiler's flags the one related to
zlib. It also avoids re-defining the _FORTIFY_SOURCE macro.
xen, blkfront: rework locking when needing to grab locks for all rings

This commit reworks locking in the cases where it is needed to grab
locks for all rings. The new logic should be simpler, even if there
is light code duplication.