AsyncMessenger: Async event threads shared by all AsyncMessenger

WorkerPool is a singleton class which is served to AsyncMessenger. All
AsyncMessenger used the same worker pool.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Ensure "mark_down" complete when returned

Now AsyncConnection try to process or modify any own variables within self
thread. It means actual function will be called by event loop not external.
So we can avoid lockdep or unnecessary lock for AsyncConnection.

So "mark_down" should be returned after _stop completed and all events has
be processed.

"external" for unregister_conn is unnecessary, because the caller won't
own AsyncMessenger::Lock again.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Introduce "signal" event

Ensure signal cond after all previous events has be done

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Event: Fix Coverity error

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Avoid deadlock for AsyncConnection::lock

accept and connection will be send to queue and deliver to dispatcher. So
it can avoid caller stuck into AsyncConnection::lock deadlock

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncConnection: Skip delete_file_event if sd < 0

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMessenger: Fix thread destroy when no active Messenger

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Cycles: A precious performance profile tool using rdstc

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
ObjectStoreBenchmark: Used to perf ObjectStore::Transaction

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
CephContext: Add AssociatedSingletonObject to allow CephContext's singleton

If some objects associated to CephContext want to create a singleton object,
it can inherit AssociatedSingletonObject and implement destruction to get notified.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMessenger: Make WorkerPool use CephContext's singleton

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
arch: add support for HW_CAP based neon runtime detection

Rename the files from neon to arm to reflect the fact that it's related
to arm processors and also because NEON was renamed ASIMD later. The
NEON and ASIMD features are mutually exclusive. 32bits binaries will get
NEON and never ASIMD, if they run on ARMv7 or ARMv8. 64bits binaries
will only run on ARMv8 and get ASIMD and never NEON.

The flag remains with _neon and no other flag is introduced since there
is no risk of confusion. Besides people who care usually know NEON but
are not yet aware of the ASIMD renaming. Keeping the _neon name probably
saves some questions.

http://tracker.ceph.com/issues/10197 Fixes: #10197

Signed-off-by: Loic Dachary <ldachary@redhat.com>
common/Initialize.h: add header file to Makefile.am

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
objectstore_tool: update usage strings

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: refactor list-lost and fix-lost

Abstract out the PG exploration loops and encapsulate the list-lost and
fix-lost semantic in a callable object.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: lookup objects by name

If the object is not a parsable JSON string, assume an object name and
look it up in all the PGs. If multiple objects have the same name, only
apply the command to one of them. It is primarily useful in a test
environment where the names of the tests objects are known and only a
small number of objects exists. It replaces the following:

    path='--data-path dev/osd0 --journal-path dev/osd0.journal'
    for pgid in $(./ceph_objectstore_tool $path --op list-pgs) ; do
      object=$(./ceph_objectstore_tool $path --pgid $pgid --op list |
               grep '"oid":"NAME"')
      test -n "$object" && break
    done
    ./ceph_objectstore_tool $path --pgid $pgid "$object" remove

with:

    ./ceph_objectstore_tool $path NAME remove

http://tracker.ceph.com/issues/10192 Fixes: #10192

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: filter --op list and explore all PGs

The positional object name is used to filter the output of --op list and
only show the objects with a matching name. If both the object name and
the pgid are omitted, all objects from all PGs are displayed.

The output format is changed from

    {"oid":"GROUP","key":"","snapid":-2,
     "hash":2659194943,"max":0,"pool":0,"namespace":""}

to

    [["0.7_head",{"oid":"GROUP","key":"","snapid":-2,
                  "hash":2659194943,"max":0,"pool":0,
                  "namespace":""}]]

where the first member is the pgid where the object is found.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: parse new object description format

The object format changed from

    {json object}

to

    [pgid,{json object}]

The parser is updated accordingly. If the --pgid is present, check that
it equals the pgid from the object description.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
objectstore_tool: test --op list variants

Signed-off-by: Loic Dachary <ldachary@redhat.com>
ceph_objectstore_tool: In error case umount objectstore

Signed-off-by: David Zafman <dzafman@redhat.com>