Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16661 common: Integrate PMDK logging system w/ VOS logging system. #14923

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
149320c
Integrate PMDK logging system w/ VOS logging system.
grom72 Aug 13, 2024
1011420
HARK is reported as INFO
grom72 Sep 3, 2024
f9b926d
Fix - force build
grom72 Sep 4, 2024
45e6548
Skip NLT tests as they blocks functional validation.
grom72 Sep 4, 2024
76fe5c6
Fix: apply git-format-clang chanhes
grom72 Sep 20, 2024
a516943
Test: re-run to remove failed Trivy build
grom72 Sep 25, 2024
224ea5c
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Oct 4, 2024
c445554
No error message on intentional pmemobj transaction abort
grom72 Oct 4, 2024
055c40f
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Oct 24, 2024
8f2b121
Fix merge
grom72 Oct 24, 2024
6a85d36
Fix: apply fix for https://github.com/pmem/pmdk/issues/6107
grom72 Oct 25, 2024
c5935f1
fix: skip NLT tests for full HW validation
grom72 Oct 28, 2024
3e73bd5
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Oct 31, 2024
ec17be3
Fix: apply fix for https://github.com/pmem/pmdk/issues/6126
grom72 Oct 31, 2024
9c1a53e
Fix: apply final fix for https://github.com/pmem/pmdk/issues/6126
grom72 Nov 5, 2024
4672438
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Nov 6, 2024
4c0b796
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-loging
grom72 Nov 18, 2024
a7ad9fa
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Jan 7, 2025
bd924f6
Update copyright info
grom72 Jan 7, 2025
f1e6c21
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Jan 16, 2025
7beccb8
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Jan 20, 2025
1d3f89a
Optimizing the use of the DD_FLAG() macro
jolivier23 Jan 29, 2025
13dd692
pmdk_log_function optimization
jolivier23 Jan 29, 2025
2b2b30c
Unified parameters naming convention
grom72 Jan 30, 2025
303a42d
pmemobj log to daos translation tab optimization
grom72 Jan 30, 2025
ce9fa93
Merge remote-tracking branch 'origin/master' into grom72/pmdk-w-logging
grom72 Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
daos (2.7.101-3) unstable; urgency=medium
daos (2.7.101-5) unstable; urgency=medium
[ Tomasz Gromadzki ]
* pmemobj errors and warnings reported via DAOS logging system

-- Tomasz Gromadzki <[email protected]> Tue, 14 Jan 2025 12:00:00 +0200

daos (2.7.101-4) unstable; urgency=medium
[ Jeff Olivier ]
* Switch from libfuse3 to libfused

-- Jeff Olivier <[email protected]> Thu, 19 Dec 2024 20:15:00 +0000
-- Jeff Olivier <[email protected]> Fri, 20 Dec 2024 20:15:00 +0000

daos (2.7.101-3) unstable; urgency=medium
[ Phillip Henderson ]
* Fix protobuf-c requiremnent for daos-client-tests on Leap.

-- Phillip Henderson <[email protected]> Thu, 19 Dec 2024 13:05:00 -0500

daos (2.7.101-2) unstable; urgency=medium
[ Denis Barakhtanov ]
Expand All @@ -24,7 +36,6 @@ daos (2.7.100-11) unstable; urgency=medium
-- Michael MacDonald <[email protected]> Tue, 5 Nov 2024 12:00:00 -0500

daos (2.7.100-10) unstable; urgency=medium

[ Sherin T George ]
* Add DAV v2 lib

Expand Down
65 changes: 33 additions & 32 deletions src/include/daos/debug.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* (C) Copyright 2015-2023 Intel Corporation.
* (C) Copyright 2015-2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -23,37 +24,37 @@
* predefined debug facilities (subsystems/modules), they have to be declared
* before including any libgurt headers
*/
#define DAOS_FOREACH_LOG_FAC(ACTION, arg) \
ACTION(daos, daos, arg) \
ACTION(array, array, arg) \
ACTION(kv, kv, arg) \
ACTION(common, common, arg) \
ACTION(tree, tree, arg) \
ACTION(vos, vos, arg) \
ACTION(client, client, arg) \
ACTION(server, server, arg) \
ACTION(rdb, rdb, arg) \
ACTION(rsvc, rsvc, arg) \
ACTION(pool, pool, arg) \
ACTION(container, container, arg) \
ACTION(object, object, arg) \
ACTION(placement, placement, arg) \
ACTION(rebuild, rebuild, arg) \
ACTION(mgmt, mgmt, arg) \
ACTION(bio, bio, arg) \
ACTION(tests, tests, arg) \
ACTION(dfs, dfs, arg) \
ACTION(duns, duns, arg) \
ACTION(drpc, drpc, arg) \
ACTION(security, security, arg) \
ACTION(dtx, dtx, arg) \
ACTION(chk, chk, arg) \
ACTION(dfuse, dfuse, arg) \
ACTION(il, il, arg) \
ACTION(csum, csum, arg) \
ACTION(pipeline, pipeline, arg) \
ACTION(stack, stack, arg)

#define DAOS_FOREACH_LOG_FAC(ACTION, arg) \
ACTION(daos, daos, arg) \
ACTION(array, array, arg) \
ACTION(kv, kv, arg) \
ACTION(common, common, arg) \
ACTION(tree, tree, arg) \
ACTION(vos, vos, arg) \
ACTION(pmdk, pmdk, arg) \
ACTION(client, client, arg) \
ACTION(server, server, arg) \
ACTION(rdb, rdb, arg) \
ACTION(rsvc, rsvc, arg) \
ACTION(pool, pool, arg) \
ACTION(container, container, arg) \
ACTION(object, object, arg) \
ACTION(placement, placement, arg) \
ACTION(rebuild, rebuild, arg) \
ACTION(mgmt, mgmt, arg) \
ACTION(bio, bio, arg) \
ACTION(tests, tests, arg) \
ACTION(dfs, dfs, arg) \
ACTION(duns, duns, arg) \
ACTION(drpc, drpc, arg) \
ACTION(security, security, arg) \
ACTION(dtx, dtx, arg) \
ACTION(chk, chk, arg) \
ACTION(dfuse, dfuse, arg) \
ACTION(il, il, arg) \
ACTION(csum, csum, arg) \
ACTION(pipeline, pipeline, arg) \
ACTION(stack, stack, arg)

#define DAOS_FOREACH_DB(ACTION, arg) \
/** metadata operation */ \
Expand Down
26 changes: 14 additions & 12 deletions src/include/gurt/debug.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* (C) Copyright 2017-2023 Intel Corporation.
* (C) Copyright 2025 Google LLC
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -97,20 +99,20 @@ extern void (*d_alt_assert)(const int, const char*, const char*, const int);
_D_LOG_CHECK(func, __tmp_mask, mask, ##__VA_ARGS__); \
} while (0)

#define _D_DEBUG(func, flag, ...) \
do { \
if (__builtin_expect(DD_FLAG(flag, D_LOGFAC), 0)) { \
if (DD_FLAG(flag, D_LOGFAC) == (int)DLOG_UNINIT) { \
_D_LOG_CHECK(func, \
DD_FLAG(flag, D_LOGFAC), \
(flag) | D_LOGFAC, \
##__VA_ARGS__); \
break; \
} \
func(DD_FLAG(flag, D_LOGFAC), ##__VA_ARGS__); \
} \
#define _D_DEBUG_W_SAVED_MASK(func, saved_mask, level, ...) \
do { \
if (__builtin_expect(saved_mask, 0)) { \
if ((saved_mask) == (int)DLOG_UNINIT) { \
_D_LOG_CHECK(func, saved_mask, (level) | D_LOGFAC, ##__VA_ARGS__); \
break; \
} \
func(saved_mask, ##__VA_ARGS__); \
} \
} while (0)

#define _D_DEBUG(func, flag, ...) \
_D_DEBUG_W_SAVED_MASK(func, DD_FLAG(flag, D_LOGFAC), flag, ##__VA_ARGS__)

#define D_LOG_ENABLED(flag) \
({ \
_D_DEBUG(D_NOOP, flag); \
Expand Down
2 changes: 1 addition & 1 deletion src/vos/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FILES = ["evt_iter.c", "vos_common.c", "vos_iterator.c", "vos_io.c",
"vos_dtx.c", "vos_query.c", "vos_overhead.c",
"vos_dtx_iter.c", "vos_gc.c", "vos_ilog.c", "ilog.c", "vos_ts.c",
"lru_array.c", "vos_space.c", "sys_db.c",
"vos_csum_recalc.c", "vos_pool_scrub.c"]
"vos_csum_recalc.c", "vos_pool_scrub.c", "pmdk_log.c"]


def build_vos(env, standalone):
Expand Down
92 changes: 92 additions & 0 deletions src/vos/pmdk_log.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/**
* (C) Copyright 2024 Intel Corporation.
* (C) Copyright 2025 Google LLC
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
/**
* Connecting the PMDK's logging to DAOS logging.
*
* vos/pmdk_log.c
*/

#define D_LOGFAC DD_FAC(pmdk)

#ifdef DAOS_PMEM_BUILD
#include <daos/debug.h>
#include <daos/common.h>
#include <libpmemobj/log.h>
#include <libpmemobj.h>

#define PMDK_LOG_2_DAOS_LOG_INIT(PMDK_LEVEL, DAOS_LEVEL) \
[PMDK_LEVEL] = {.level = DAOS_LEVEL, .saved_mask = &DD_FLAG(DAOS_LEVEL, D_LOGFAC)}

static struct {
int level;
int *saved_mask;
} pmemobj_log_level_2_daos_log[] = {
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_HARK, DLOG_INFO),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_FATAL, DLOG_CRIT),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_ERROR, DLOG_ERR),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_WARNING, DLOG_WARN),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_NOTICE, DLOG_NOTE),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_INFO, DLOG_INFO),
PMDK_LOG_2_DAOS_LOG_INIT(PMEMOBJ_LOG_LEVEL_DEBUG, DLOG_DBG),
};

#undef PMDK_LOG_2_DAOS_LOG_INIT

static void
pmdk_log_function(enum pmemobj_log_level level, const char *file_name, unsigned line_no,
const char *function_name, const char *message)
{
/*
* There is a set of handy macros for each of the message priorities
* that are used normally to report a message. They can't be used here
* directly since the file name, line number and the function name
* are provided via arguments to this callback function instead of
* via macro definitions (__FILE__, __LINE__, and __func__) as
* _D_LOG_NOCHECK() would like to consume them. So, the message here is
* provided a few macro-calls later via _D_DEBUG_W_SAVED_MASK() macro which allows
* to swap the _D_LOG_NOCHECK macro for a custom macro.
*
* D_ERROR(...) -> D_DEBUG(DLOG_ERR, ...) ->
* _D_DEBUG(_D_LOG_NOCHECK, DLOG_ERR, ...) ->
* _D_DEBUG_W_SAVED_MASK(_D_LOG_NOCHECK, DD_FLAG(DLOG_ERR, D_LOGFAC), DLOG_ERR, ...)
*/

/*
* A custom variant of _D_LOG_NOCHECK() which passes the file name,
* line number and the function name from the local variables.
*/
#define PMDK_LOG_NOCHECK(mask, fmt, ...) \
d_log(mask, "%s:%d %s() " fmt, file_name, line_no, function_name, ##__VA_ARGS__)

int *saved_mask = pmemobj_log_level_2_daos_log[level].saved_mask;
_D_DEBUG_W_SAVED_MASK(PMDK_LOG_NOCHECK, *saved_mask,
pmemobj_log_level_2_daos_log[level].level, "%s\n", message);

#undef PMDK_LOG_NOCHECK
}

int
pmdk_log_attach(void)
{
int rc = pmemobj_log_set_function(pmdk_log_function);
if (rc == 0) {
return 0;
} else {
return daos_errno2der(errno);
}
}

#else

int
pmdk_log_attach(void)
{
;
}

#endif /* DAOS_PMEM_BUILD */
18 changes: 18 additions & 0 deletions src/vos/pmdk_log.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* (C) Copyright 2024 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
/**
* Connecting the PMDK's logging to DAOS logging.
* vos/pmdk_log.h
*/

#ifndef __PMDK_LOG__
#define __PMDK_LOG__

int
pmdk_log_attach(void);

#endif /* __PMDK_LOG__ */
7 changes: 7 additions & 0 deletions src/vos/vos_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <daos_srv/daos_engine.h>
#include <daos_srv/smd.h>
#include "vos_internal.h"
#include "pmdk_log.h"

struct vos_self_mode {
struct vos_tls *self_tls;
Expand Down Expand Up @@ -665,6 +666,12 @@ vos_mod_init(void)
if (vos_start_epoch == DAOS_EPOCH_MAX)
vos_start_epoch = d_hlc_get();

rc = pmdk_log_attach();
if (rc != 0) {
D_ERROR("PMDK log initialization error\n");
return rc;
}

rc = vos_pool_settings_init(bio_nvme_configured(SMD_DEV_TYPE_META));
if (rc != 0) {
D_ERROR("VOS pool setting initialization error\n");
Expand Down
2 changes: 1 addition & 1 deletion utils/build.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ ucx=https://github.com/openucx/ucx.git
[patch_versions]
spdk=https://github.com/spdk/spdk/commit/b0aba3fcd5aceceea530a702922153bc75664978.diff,https://github.com/spdk/spdk/commit/445a4c808badbad3942696ecf16fa60e8129a747.diff
mercury=https://raw.githubusercontent.com/daos-stack/mercury/f3dc286fb40ec1a3a38a2e17c45497bc2aa6290d/na_ucx.patch
pmdk=https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.diff
pmdk=https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.patch,https://github.com/pmem/pmdk/commit/61e32285370e629e2b36bbb991b919e44f87d915.patch,https://github.com/pmem/pmdk/commit/518b7426a13b21f98b2d2c435fa645770899446a.patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this same patch applied in the PMDK rpm builder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jolivier23, Patch https://github.com/pmem/pmdk/commit/2abe15ac0b4eed894b6768cd82a3b0a7c4336284.patch is not required for PMDK rpm builder as it is related to ARM architecture only.
The rest are the same.

argobots=https://github.com/pmodels/argobots/pull/397/commits/411e5b344642ebc82190fd8b125db512e5b449d1.diff,https://github.com/pmodels/argobots/commit/bb0c908abfac4bfe37852eee621930634183c6aa.diff
5 changes: 4 additions & 1 deletion utils/rpms/daos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

Name: daos
Version: 2.7.101
Release: 4%{?relval}%{?dist}
Release: 5%{?relval}%{?dist}
Summary: DAOS Storage Engine

License: BSD-2-Clause-Patent
Expand Down Expand Up @@ -592,6 +592,9 @@ getent passwd daos_agent >/dev/null || useradd -s /sbin/nologin -r -g daos_agent
# No files in a shim package

%changelog
* Tue Jan 14 2025 Tomasz Gromadzki <[email protected]> 2.7.101-5
- pmemobj errors and warnings reported via DAOS logging system

* Fri Dec 20 2024 Jeff Olivier <[email protected]> 2.7.101-4
- Switch libfuse3 to libfused

Expand Down