Update RISC-V profile with syscall interception runtime fixes

Jupiter MILKV fixes. Runs io500 on libc, syscall and fuse.

Merge request reports

Loading
+33 −1
Changes for include/client/rpc/utils.hpp: 33 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -59,9 +59,41 @@
#include <cstring>
#include <type_traits>
#include <limits>
#include <mutex>

namespace gkfs::rpc {

inline thallium::remote_procedure
define_rpc(const std::shared_ptr<thallium::engine>& engine,
           const std::string& tag) {
    // Thallium's lookup-then-register sequence is not atomic. Concurrent
    // first use can register the same RPC twice and corrupt Margo metadata.
    // Share this mutex across call sites, not once per forward_call template.
    static std::mutex registration_mutex;
    const std::lock_guard<std::mutex> lock(registration_mutex);
    auto rpc = engine->define(tag);
    // define() registers MARGO_DEFAULT_PROVIDER_ID, but on(endpoint) sends
    // to provider 0. Prepare that ID here too: otherwise Margo lazily
    // registers it during forward(), outside this registration lock.
    const auto mid = engine->get_margo_instance();
    hg_id_t id;
    hg_bool_t registered;
    if(margo_provider_registered_name(mid, tag.c_str(), 0, &id, &registered) !=
       HG_SUCCESS) {
        throw std::runtime_error("Failed to look up RPC provider: " + tag);
    }
    if(!registered) {
        id = margo_provider_register_name(mid, tag.c_str(),
                                          thallium::hg_proc_meta_serialization,
                                          thallium::hg_proc_meta_serialization,
                                          nullptr, 0, ABT_POOL_NULL);
        if(id == 0) {
            throw std::runtime_error("Failed to register RPC provider: " + tag);
        }
    }
    return rpc;
}

template <typename Rpc, typename Input>
auto
forward_with_timeout(Rpc& rpc, const thallium::endpoint& endp,
@@ -232,7 +264,7 @@ forward_call(const std::shared_ptr<thallium::engine>& engine,
                in.trace_id, tag);
        }

        auto rpc = engine->define(tag);
        auto rpc = define_rpc(engine, tag);
        Output out = forward_with_timeout(rpc, endp, in);

        // Some output structs might not have .err, but most do.
+12 −0
Changes for include/client/gkfs_libc.hpp: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -76,6 +76,14 @@ open(const char* path, int flags, ...);
int
open64(const char* path, int flags, ...);
int
__open_2(const char* path, int flags);
int
__open64_2(const char* path, int flags);
int
__openat_2(int dirfd, const char* path, int flags);
int
__openat64_2(int dirfd, const char* path, int flags);
int
openat(int dirfd, const char* path, int flags, ...);
int
openat64(int dirfd, const char* path, int flags,
@@ -117,6 +125,8 @@ lseek64(int fd, off64_t offset, int whence);
int
ftruncate(int fd, off_t length);
int
ftruncate64(int fd, off64_t length);
int
fsync(int fd);
int
flock(int fd, int operation);
@@ -249,6 +259,8 @@ fchmod(int fd, mode_t mode) throw();
int
fchmodat(int dfd, const char* path, mode_t mode, int flags) throw();
int
__fchmodat(int dfd, const char* path, mode_t mode, int flags) throw();
int
chown(const char* path, uid_t owner, gid_t group) throw();
int
fchown(int fd, uid_t owner, gid_t group) throw();
+2 −1
Changes for scripts/profiles/0.9.6-dev/riscv.specs: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ clonedeps=(
    ["mercury"]="v2.4.1"
    ["margo"]="v0.21.0"
    ["thallium"]="v0.15.1"
    ["syscall_intercept"]="f2a644ab5e9742f3d55dcc23ae6d0d0a153da491"
    # RISC-V patching/relocation fixes; threaded futex failures remain unresolved.
    ["syscall_intercept"]="8db291aa6b9cf8b02303de3c15f2d96e4d9d45d5"
)

# Extra arguments for git clone
+11 −6
Changes for src/client/rpc/forward_data.cpp: 11 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ forward_data_helper(std::string rpc_tag,
    std::vector<thallium::async_response> waiters;
    waiters.reserve(targets.size());

    auto rpc = CTX->rpc_engine()->define(rpc_tag);
    auto rpc = gkfs::rpc::define_rpc(CTX->rpc_engine(), rpc_tag);

    for(const auto& target : targets) {
        try {
@@ -249,7 +249,8 @@ forward_write(const string& path, const void* buf, const off64_t offset,

    // Keep track of targets for error reporting

    auto write_rpc = CTX->rpc_engine()->define(gkfs::rpc::tag::write);
    auto write_rpc =
            gkfs::rpc::define_rpc(CTX->rpc_engine(), gkfs::rpc::tag::write);

    for(std::size_t i = 0; i < targets.size(); ++i) {
        auto target = targets[i];
@@ -489,7 +490,8 @@ forward_read(const string& path, void* buf, const off64_t offset,
    std::vector<uint64_t> waiter_targets;
    waiter_targets.reserve(targets.size());

    auto read_rpc = CTX->rpc_engine()->define(gkfs::rpc::tag::read);
    auto read_rpc =
            gkfs::rpc::define_rpc(CTX->rpc_engine(), gkfs::rpc::tag::read);

    auto err = 0;
    ssize_t out_size = 0;
@@ -631,7 +633,8 @@ repair_data_copy(const gkfs::rpc::repair_task& task) {
        read_bulk = CTX->rpc_engine()->expose(read_segments,
                                              thallium::bulk_mode::write_only);

        auto read_rpc = CTX->rpc_engine()->define(gkfs::rpc::tag::read);
        auto read_rpc =
                gkfs::rpc::define_rpc(CTX->rpc_engine(), gkfs::rpc::tag::read);
        gkfs::rpc::rpc_read_data_in_t read_in{};
        read_in.path = task.path;
        read_in.offset = 0;
@@ -660,7 +663,8 @@ repair_data_copy(const gkfs::rpc::repair_task& task) {
                {buffer.data(), static_cast<std::size_t>(read_out.io_size)}};
        auto write_bulk = CTX->rpc_engine()->expose(
                write_segments, thallium::bulk_mode::read_only);
        auto write_rpc = CTX->rpc_engine()->define(gkfs::rpc::tag::write);
        auto write_rpc =
                gkfs::rpc::define_rpc(CTX->rpc_engine(), gkfs::rpc::tag::write);

        gkfs::rpc::rpc_write_data_in_t write_in{};
        write_in.path = task.path;
@@ -769,7 +773,8 @@ forward_get_chunk_stat() {
    unsigned long chunk_total = 0;
    unsigned long chunk_free = 0;
    std::size_t successful_hosts = 0;
    auto stat_rpc = CTX->rpc_engine()->define(gkfs::rpc::tag::get_chunk_stat);
    auto stat_rpc = gkfs::rpc::define_rpc(CTX->rpc_engine(),
                                          gkfs::rpc::tag::get_chunk_stat);

    for(const auto host : hosts) {
        gkfs::rpc::rpc_chunk_stat_in_t in;
+8 −8
Changes for src/client/rpc/forward_data_proxy.cpp: 8 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -102,8 +102,8 @@ forward_write_proxy(const string& path, const void* buf, off64_t offset,
        in.write_size = write_size;
        in.bulk_handle = bulk_handle;

        auto write_rpc =
                CTX->ipc_engine()->define(gkfs::rpc::tag::client_proxy_write);
        auto write_rpc = gkfs::rpc::define_rpc(
                CTX->ipc_engine(), gkfs::rpc::tag::client_proxy_write);
        gkfs::rpc::rpc_data_out_t out =
                forward_with_timeout(write_rpc, endp, in);

@@ -136,8 +136,8 @@ forward_read_proxy(const string& path, void* buf, const off64_t offset,
        in.read_size = read_size;
        in.bulk_handle = bulk_handle;

        auto read_rpc =
                CTX->ipc_engine()->define(gkfs::rpc::tag::client_proxy_read);
        auto read_rpc = gkfs::rpc::define_rpc(
                CTX->ipc_engine(), gkfs::rpc::tag::client_proxy_read);
        gkfs::rpc::rpc_data_out_t out =
                forward_with_timeout(read_rpc, endp, in);

@@ -160,8 +160,8 @@ forward_truncate_proxy(const std::string& path, size_t current_size,
        in.current_size = current_size;
        in.new_size = new_size;

        auto trunc_rpc = CTX->ipc_engine()->define(
                gkfs::rpc::tag::client_proxy_truncate);
        auto trunc_rpc = gkfs::rpc::define_rpc(
                CTX->ipc_engine(), gkfs::rpc::tag::client_proxy_truncate);
        gkfs::rpc::rpc_err_out_t out =
                forward_with_timeout(trunc_rpc, endp, in);

@@ -183,8 +183,8 @@ forward_get_chunk_stat_proxy() {
        gkfs::rpc::rpc_chunk_stat_in_t in;
        in.dummy = 0;

        auto chunk_stat_rpc = CTX->ipc_engine()->define(
                gkfs::rpc::tag::client_proxy_chunk_stat);
        auto chunk_stat_rpc = gkfs::rpc::define_rpc(
                CTX->ipc_engine(), gkfs::rpc::tag::client_proxy_chunk_stat);
        gkfs::rpc::rpc_chunk_stat_out_t out =
                forward_with_timeout(chunk_stat_rpc, endp, in);

Loading
Loading