Skip to content

Commit d4bd6f2

Browse files
authored
Merge pull request pmem#5950 from grom72/obsolete-on_pmemcheck
common: Clean-up Valgrind usage in the project
2 parents 457c61d + 8188ab6 commit d4bd6f2

File tree

30 files changed

+175
-24
lines changed

30 files changed

+175
-24
lines changed

.github/actions/pmem_test_prepare/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: Build with the fault injection capability
1010
required: false
1111
default: '0'
12+
valgrind:
13+
description: Build with Valgrind support
14+
required: true
15+
1216
runs:
1317
using: composite
1418
steps:
@@ -30,6 +34,9 @@ runs:
3034
- env:
3135
FAULT_INJECTION: ${{ inputs.fault_injection }}
3236
NDCTL_ENABLE: ${{ inputs.ndctl_enable }}
37+
PMEMOBJ_IGNORE_DIRTY_SHUTDOWN: ${{ inputs.ndctl_enable == 'n' && 'y' || 'n' }}
38+
PMEMOBJ_IGNORE_BAD_BLOCKS: ${{ inputs.ndctl_enable == 'n' && 'y' || 'n' }}
39+
VALGRIND: ${{ inputs.valgrind }}
3340
run: |
3441
echo '::group::Build'
3542
$WORKDIR/build-pmdk.sh

.github/workflows/pmem_test_matrix.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
force_enable:
1010
required: true
1111
type: string
12+
valgrind:
13+
required: true
14+
type: string
1215
timeout_minutes:
1316
required: false
1417
type: number
@@ -28,11 +31,14 @@ jobs:
2831
os: [rhel, opensuse]
2932
build: [debug, nondebug]
3033

34+
3135
steps:
3236
- uses: actions/checkout@v4
3337

3438
- name: Test prepare
3539
uses: ./.github/actions/pmem_test_prepare
40+
with:
41+
valgrind: ${{ inputs.valgrind }}
3642

3743
- name: Test run
3844
uses: ./.github/actions/pmem_test_run

.github/workflows/pmem_tests.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ on:
1212
jobs:
1313
# Test the default build with the basic test suite.
1414
Basic:
15+
strategy:
16+
matrix:
17+
VALGRIND: [0, 1]
18+
name: Basic ${{ matrix.VALGRIND == 0 && 'w/o Valgrind' || 'w/ Valgrind' }}
1519
uses: ./.github/workflows/pmem_test_matrix.yml
1620
with:
1721
# Exclude all Valgrind tests. All tests employing Valgrind tooling are run
1822
# in the dedicated workflows below.
1923
force_enable: '["none"]'
24+
valgrind: ${{ matrix.VALGRIND }}
2025

2126

2227
# Test the default build with force-enabled Valgrind tooling for (persistent)
@@ -25,6 +30,7 @@ jobs:
2530
uses: ./.github/workflows/pmem_test_matrix.yml
2631
with:
2732
force_enable: '["pmemcheck", "memcheck"]'
33+
valgrind: 1
2834

2935

3036
# Test the default build with force-enabled Valgrind tooling for thread error
@@ -33,6 +39,7 @@ jobs:
3339
uses: ./.github/workflows/pmem_test_matrix.yml
3440
with:
3541
force_enable: '["drd", "helgrind"]'
42+
valgrind: 1
3643
# 9h = 7h20m (the longest workflow execution time) + ~20% leeway.
3744
timeout_minutes: 540
3845

@@ -52,6 +59,8 @@ jobs:
5259

5360
- name: Test prepare
5461
uses: ./.github/actions/pmem_test_prepare
62+
with:
63+
valgrid: 1
5564

5665
- name: Test run
5766
uses: ./.github/actions/pmem_test_run
@@ -73,6 +82,7 @@ jobs:
7382
uses: ./.github/actions/pmem_test_prepare
7483
with:
7584
fault_injection: '1'
85+
valgrind: 1
7686

7787
- name: Test run
7888
uses: ./.github/actions/pmem_test_run
@@ -84,6 +94,8 @@ jobs:
8494
# By default, PMDK is built with NDCTL in order to provide RAS features.
8595
# This build is only viable as long as DAOS builds PMDK with NDCTL_ENABLE=n
8696
# https://github.com/daos-stack/pmdk/pull/12
97+
# It should be removed as soon as following PR is merged
98+
# https://github.com/daos-stack/pmdk/pull/35
8799
ndctl_enable_n:
88100
name: Without ndctl
89101
if: github.repository == 'pmem/pmdk'
@@ -96,6 +108,7 @@ jobs:
96108
uses: ./.github/actions/pmem_test_prepare
97109
with:
98110
ndctl_enable: n
111+
valgrind: 0
99112

100113
- name: Test run
101114
uses: ./.github/actions/pmem_test_run

.github/workflows/scan_codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
languages: cpp, python
4242

4343
- name: Build PMDK
44-
run: make EXTRA_CFLAGS=-DUSE_VALGRIND test -j$(nproc)
44+
run: make test -j$(nproc)
4545

4646
- name: CodeQL scan
4747
uses: github/codeql-action/analyze@v2

ChangeLog

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Mon Dec 4 2023 Oksana Sałyk <[email protected]>
1717
- Reduces libpmemobj's stack usage below the 11kB threshold.
1818
- Fixing minor Coverity issues
1919
- Add a new toolset for stack usage analysis (https://github.com/pmem/pmdk/tree/master/utils/call_stacks_analysis)
20-
2120

2221
Tue Aug 8 2023 Oksana Sałyk <[email protected]>
2322

INSTALL.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,12 @@ Both building and installation scripts are very flexible. To see additional opti
108108
### Memory Management Tools
109109

110110
The PMDK libraries support standard Valgrind DRD, Helgrind and Memcheck, as well as a PM-aware version of [Valgrind](https://github.com/pmem/valgrind).
111-
By default, support for all tools is enabled. If you wish to disable it, supply the compiler with `VG_\<TOOL\>_ENABLED` flag set to 0, for example:
111+
By default, support for all tools is enabled. If you wish to disable it, supply the compiler with `VALGRIND` flag set to 0:
112112

113113
```sh
114-
make EXTRA_CFLAGS=-DVG_MEMCHECK_ENABLED=0
114+
make VALGRIND=0
115115
```
116116

117-
`VALGRIND_ENABLED` flag, when set to 0, disables all Valgrind tools
118-
(drd, helgrind, memcheck and pmemcheck).
119-
120117
The `SANITIZE` flag allows the libraries to be tested with various
121118
sanitizers. For example, to test the libraries with AddressSanitizer
122119
and UndefinedBehaviorSanitizer, run:

src/benchmarks/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright 2014-2023, Intel Corporation
2+
# Copyright 2014-2024, Intel Corporation
33

44
#
55
# src/benchmarks/Makefile -- build all benchmarks
@@ -109,6 +109,11 @@ LDFLAGS += $(GCOV_LDFLAGS)
109109
LIBS += $(GCOV_LIBS)
110110
endif
111111

112+
ifeq ($(VALGRIND),0)
113+
CFLAGS += -DVALGRIND_ENABLED=0
114+
CXXFLAGS += -DVALGRIND_ENABLED=0
115+
endif
116+
112117
ifneq ($(SANITIZE),)
113118
CXXFLAGS += -fsanitize=$(SANITIZE)
114119
LDFLAGS += -fsanitize=$(SANITIZE)

src/core/valgrind_internal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* SPDX-License-Identifier: BSD-3-Clause */
2-
/* Copyright 2015-2023, Intel Corporation */
2+
/* Copyright 2015-2024, Intel Corporation */
33

44
/*
55
* valgrind_internal.h -- internal definitions for valgrind macros
@@ -19,6 +19,11 @@
1919
#define VG_HELGRIND_ENABLED 1
2020
#define VG_MEMCHECK_ENABLED 1
2121
#define VG_DRD_ENABLED 1
22+
#else
23+
#define VG_PMEMCHECK_ENABLED 0
24+
#define VG_HELGRIND_ENABLED 0
25+
#define VG_MEMCHECK_ENABLED 0
26+
#define VG_DRD_ENABLED 0
2227
#endif
2328

2429
#if VG_PMEMCHECK_ENABLED || VG_HELGRIND_ENABLED || VG_MEMCHECK_ENABLED || \

src/examples/Makefile.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright 2015-2020, Intel Corporation
2+
# Copyright 2015-2024, Intel Corporation
33

44
#
55
# examples/Makefile.inc -- build the Persistent Memory Development Kit examples
@@ -23,6 +23,10 @@ CFLAGS += -fsanitize=$(SANITIZE)
2323
CXXFLAGS += -fsanitize=$(SANITIZE)
2424
LDFLAGS += -fsanitize=$(SANITIZE)
2525
endif
26+
ifeq ($(VALGRIND),0)
27+
CFLAGS += -DVALGRIND_ENABLED=0
28+
CXXFLAGS += -DVALGRIND_ENABLED=0
29+
endif
2630
INCS = -I$(INCDIR) -I. -I$(TOP_SRC)/examples $(OS_INCS)
2731
LIBS += $(OS_LIBS) $(LIBUUID)
2832

src/libpmem2/x86_64/memcpy/memcpy_avx.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,13 @@ memmove_small_avx(char *dest, const char *src, size_t len, flush_fn flush)
8787
* path) in the optimized version.
8888
* libc's memcpy also does that, so we can't use it here.
8989
*/
90+
#if VG_PMEMCHECK_ENABLED
9091
if (On_pmemcheck) {
9192
memmove_nodrain_generic(dest, src, len, PMEM2_F_MEM_NOFLUSH,
9293
NULL, NULL);
93-
} else {
94+
} else
95+
#endif
96+
{
9497
memmove_small_avx_noflush(dest, src, len);
9598
}
9699

0 commit comments

Comments
 (0)