Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b94fb08

Browse files
authored
Merge branch 'DynamoRIO:master' into access_pattern
2 parents 6c530a8 + d302f5e commit b94fb08

39 files changed

+3505
-3593
lines changed

.github/workflows/ci-aarchxx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
matrix:
5252
# This job will run in parallel.
5353
include:
54-
- os: ubuntu-20-arm64
54+
- os: ubuntu-20-arm64-pre-sve
5555
sve: false
5656
- os: ubuntu-20-arm64-sve
5757
sve: true

api/docs/release.dox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ changes:
161161
signature between AArch64 and RISC-V.
162162
- Renamed dr_get_sve_vector_length() to dr_get_vector_length() to share function
163163
signature between AArch64 and RISC-V.
164+
- Changed the drcachesim -LL_miss_file option by adding a process ID field to the output.
165+
This helps in better analyzing cache misses in multi-process environments.
164166

165167
Further non-compatibility-affecting changes include:
166168
- Added DWARF-5 support to the drsyms library by linking in 4 static libraries

api/docs/triager.dox

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ******************************************************************************
2-
* Copyright (c) 2010-2022 Google, Inc. All rights reserved.
2+
* Copyright (c) 2010-2024 Google, Inc. All rights reserved.
33
* ******************************************************************************/
44

55
/*
@@ -42,6 +42,17 @@ We have a rotating Triager who is responsible for monitoring our continuous test
4242
- File an issue on previously-unknown failures, or update existing issues for repeats. Consider marking tests as flaky in `runsuite_wrapper.pl` if they are keeping the master merge red.
4343
- Answer (or request that someone else who is more of an expert in that area answer) incoming dynamorio-users emails.
4444
- Sometimes emails to the list are marked as spam, so it is a good idea to directly watch the web interface: https://groups.google.com/g/DynamoRIO-Users
45+
- Moderate dynamorio-users emails from new users. First, ensure that you are a member of
46+
the dynamorio-users list and your role is Manager at
47+
https://groups.google.com/g/dynamorio-users/members. You will then receive an email
48+
whenever a message is sent from a user who has never posted before. Such a message
49+
stays pending at https://groups.google.com/g/dynamorio-users/pending-messages until it
50+
is approved or rejected. Generally, we allow all future messages from a user when the
51+
first message sent is legitimate. At the pending message page, expand the message to
52+
examine it. Click the checkbox next to it, which enables the top buttons. If the
53+
message is spam, click "Report spam and ban author"; if it is not spam, click "Post and
54+
always allow". We generally do not use the single-message reject or allow buttons.
55+
Once it is posted it will show up in the list and can be replied to there.
4556
- Triage reviewing pull requests filed by users
4657
- Make sure you receive notifications on such requests: see the issues item below on how to set that up. Alternatively, proactively monitor the pull request list through the web site.
4758
- Triage issues filed by users in our issue tracker.

clients/drcachesim/common/options.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ droption_t<std::string> op_LL_miss_file(
208208
"Path for dumping LLC misses or prefetching hints",
209209
"If non-empty, when running the cache simulator, requests that "
210210
"every last-level cache miss be written to a file at the specified path. Each miss "
211-
"is written in text format as a <program counter, address> pair. If this tool is "
212-
"linked with zlib, the file is written in gzip-compressed format. If non-empty, when "
213-
"running the cache miss analyzer, requests that prefetching hints based on the miss "
214-
"analysis be written to the specified file. Each hint is written in text format as a "
215-
"<program counter, stride, locality level> tuple.");
211+
"is written in text format as a <process id, program counter, address> tuple. If "
212+
"this tool is linked with zlib, the file is written in gzip-compressed format. If "
213+
"non-empty, when running the cache miss analyzer, requests that prefetching hints "
214+
"based on the miss analysis be written to the specified file. Each hint is written "
215+
"in text format as a <program counter, stride, locality level> tuple.");
216216

217217
droption_t<bool> op_L0_filter_deprecated(
218218
DROPTION_SCOPE_CLIENT, "L0_filter", false,

clients/drcachesim/scheduler/scheduler.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,21 @@
7474
#include "utils.h"
7575

7676
#undef VPRINT
77-
#ifdef DEBUG
78-
# define VPRINT(obj, level, ...) \
79-
do { \
80-
if ((obj)->verbosity_ >= (level)) { \
81-
fprintf(stderr, "%s ", (obj)->output_prefix_); \
82-
fprintf(stderr, __VA_ARGS__); \
83-
} \
84-
} while (0)
85-
# define VDO(obj, level, statement) \
86-
do { \
87-
if ((obj)->verbosity_ >= (level)) \
88-
statement \
89-
} while (0)
90-
#else
91-
# define VPRINT(reader, level, ...) /* Nothing. */
92-
# define VDO(obj, level, statementx) /* Nothing. */
93-
#endif
77+
// We make logging available in release build to help in diagnosing issues
78+
// and understanding scheduler behavior.
79+
// We assume the extra branches do not add undue overhead.
80+
#define VPRINT(obj, level, ...) \
81+
do { \
82+
if ((obj)->verbosity_ >= (level)) { \
83+
fprintf(stderr, "%s ", (obj)->output_prefix_); \
84+
fprintf(stderr, __VA_ARGS__); \
85+
} \
86+
} while (0)
87+
#define VDO(obj, level, statement) \
88+
do { \
89+
if ((obj)->verbosity_ >= (level)) \
90+
statement \
91+
} while (0)
9492

9593
namespace dynamorio {
9694
namespace drmemtrace {

clients/drcachesim/simulator/cache_miss_analyzer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ cache_miss_stats_t::dump_miss(const memref_t &memref)
8383
return;
8484
}
8585

86+
// TODO i#6905: Consider incorporating PID information into the pc_cache_misses_ hash
87+
// map and adjusting subsequent calculations that depend on this data.
8688
const addr_t pc = memref.data.pc;
8789
const addr_t addr = memref.data.addr / kLineSize;
8890
pc_cache_misses_[pc].push_back(addr);

clients/drcachesim/simulator/caching_device_stats.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ void
154154
caching_device_stats_t::dump_miss(const memref_t &memref)
155155
{
156156
addr_t pc, addr;
157+
memref_pid_t pid;
157158
if (type_is_instr(memref.instr.type))
158159
pc = memref.instr.addr;
159160
else { // data ref: others shouldn't get here
@@ -163,10 +164,15 @@ caching_device_stats_t::dump_miss(const memref_t &memref)
163164
pc = memref.data.pc;
164165
}
165166
addr = memref.data.addr;
167+
pid = memref.data.pid;
168+
169+
// XXX: This writing method to the same file from multiple processes is racy.
170+
// It works most of the time but consider using a directory with individual files
171+
// per process as a future safer alternative.
166172
#ifdef HAS_ZLIB
167-
gzprintf(file_, "0x%zx,0x%zx\n", pc, addr);
173+
gzprintf(file_, "%lld,0x%zx,0x%zx\n", pid, pc, addr);
168174
#else
169-
fprintf(file_, "0x%zx,0x%zx\n", pc, addr);
175+
fprintf(file_, "%lld,0x%zx,0x%zx\n", pid, pc, addr);
170176
#endif
171177
}
172178

clients/drcachesim/simulator/snoop_filter.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,8 @@ void
7474
snoop_filter_t::snoop(addr_t tag, int id, bool is_write)
7575
{
7676
coherence_table_entry_t *coherence_entry = &coherence_table_[tag];
77-
// Initialize new snoop filter entry.
78-
if (coherence_entry->sharers.empty()) {
79-
coherence_entry->sharers.resize(num_snooped_caches_, false);
80-
coherence_entry->dirty = false;
81-
}
8277

83-
auto num_sharers = std::count(coherence_entry->sharers.begin(),
84-
coherence_entry->sharers.end(), true);
78+
size_t num_sharers = coherence_entry->sharers.size();
8579

8680
// Check that cache id is valid.
8781
assert(id >= 0 && id < num_snooped_caches_);
@@ -91,7 +85,8 @@ snoop_filter_t::snoop(addr_t tag, int id, bool is_write)
9185
assert(!coherence_entry->dirty || num_sharers == 1);
9286

9387
// Check if this request causes a writeback.
94-
if (!coherence_entry->sharers[id] && coherence_entry->dirty) {
88+
if (coherence_entry->sharers.find(id) == coherence_entry->sharers.end() &&
89+
coherence_entry->dirty) {
9590
num_writebacks_++;
9691
coherence_entry->dirty = false;
9792
}
@@ -101,16 +96,18 @@ snoop_filter_t::snoop(addr_t tag, int id, bool is_write)
10196
coherence_entry->dirty = true;
10297
if (num_sharers > 0) {
10398
// Writes will invalidate other caches_.
104-
for (int i = 0; i < num_snooped_caches_; i++) {
105-
if (coherence_entry->sharers[i] && id != i) {
106-
caches_[i]->invalidate(tag, INVALIDATION_COHERENCE);
107-
num_invalidates_++;
108-
coherence_entry->sharers[i] = false;
109-
}
99+
auto it = coherence_entry->sharers.begin();
100+
while (it != coherence_entry->sharers.end()) {
101+
int i = *it++;
102+
if (i == id)
103+
continue;
104+
caches_[i]->invalidate(tag, INVALIDATION_COHERENCE);
105+
num_invalidates_++;
106+
coherence_entry->sharers.erase(i);
110107
}
111108
}
112109
}
113-
coherence_entry->sharers[id] = true;
110+
coherence_entry->sharers.insert(id);
114111
}
115112

116113
/* This function is called whenever a coherent cache evicts a line. */
@@ -120,20 +117,23 @@ snoop_filter_t::snoop_eviction(addr_t tag, int id)
120117
coherence_table_entry_t *coherence_entry = &coherence_table_[tag];
121118

122119
// Check if sharer list is initialized.
123-
assert(coherence_entry->sharers.size() == (uint64_t)num_snooped_caches_);
120+
assert(!coherence_entry->sharers.empty());
124121
// Check that cache id is valid.
125122
assert(id >= 0 && id < num_snooped_caches_);
126123
// Check that tag is valid.
127124
assert(tag != TAG_INVALID);
128125
// Check that we currently have this cache marked as a sharer.
129-
assert(coherence_entry->sharers[id]);
126+
assert(coherence_entry->sharers.find(id) != coherence_entry->sharers.end());
130127

131128
if (coherence_entry->dirty) {
132129
num_writebacks_++;
133130
coherence_entry->dirty = false;
134131
}
135132

136-
coherence_entry->sharers[id] = false;
133+
coherence_entry->sharers.erase(id);
134+
if (coherence_entry->sharers.empty()) {
135+
coherence_table_.erase(tag);
136+
}
137137
}
138138

139139
void

clients/drcachesim/simulator/snoop_filter.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <stdint.h>
3737

3838
#include <unordered_map>
39+
#include <unordered_set>
3940
#include <vector>
4041

4142
#include "cache.h"
@@ -45,8 +46,8 @@ namespace dynamorio {
4546
namespace drmemtrace {
4647

4748
struct coherence_table_entry_t {
48-
std::vector<bool> sharers;
49-
bool dirty;
49+
std::unordered_set<int> sharers; // IDs of caches sharing this line.
50+
bool dirty = false;
5051
};
5152

5253
class snoop_filter_t {

clients/drcov/CMakeLists.txt

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,15 @@ get_property(dox_targets GLOBAL PROPERTY DynamoRIO_dox_targets)
175175
set_property(GLOBAL PROPERTY DynamoRIO_dox_targets ${dox_targets} ${doctgt})
176176

177177
add_custom_target(${doctgt} DEPENDS ${gendoc})
178-
# FIXME i#3544: Re-enable once RISC-V binaries work so that options can be generated.
179-
if (RISCV64 AND NOT CMAKE_CROSSCOMPILING)
180-
file(COPY_FILE ${srcdoc} ${gendoc})
181-
else ()
182-
add_custom_command(
183-
OUTPUT ${gendoc}
184-
DEPENDS ${srcdoc}
185-
drcov2lcov
186-
COMMAND ${CMAKE_COMMAND}
187-
ARGS -D src=${srcdoc}
188-
-D dst=${gendoc}
189-
-D CMAKE_CROSSCOMPILING=${CMAKE_CROSSCOMPILING}
190-
-D prog=$<TARGET_FILE:drcov2lcov>
191-
-D prog_arg=-help_html
192-
-P ${CMAKE_CURRENT_SOURCE_DIR}/../common/gendocs.cmake
193-
VERBATIM)
194-
endif ()
178+
add_custom_command(
179+
OUTPUT ${gendoc}
180+
DEPENDS ${srcdoc}
181+
drcov2lcov
182+
COMMAND ${CMAKE_COMMAND}
183+
ARGS -D src=${srcdoc}
184+
-D dst=${gendoc}
185+
-D CMAKE_CROSSCOMPILING=${CMAKE_CROSSCOMPILING}
186+
-D prog=$<TARGET_FILE:drcov2lcov>
187+
-D prog_arg=-help_html
188+
-P ${CMAKE_CURRENT_SOURCE_DIR}/../common/gendocs.cmake
189+
VERBATIM)

0 commit comments

Comments
 (0)