Skip to content

Commit dfcade7

Browse files
committed
Merge remote-tracking branch 'remotes/stsquad/tags/pull-misc-for-rc0-150720-3' into staging
Final fixes for 5.1-rc0 - minor documentation nit - docker.py bootstrap fixes - tweak containers.yml wildcards - fix float16 nan detection - conditional use of -Wpsabi - fix missing iotlb data for plugins - proper locking for helper based bb count - drop ppc64abi32 from the plugin check-tcg test # gpg: Signature made Wed 15 Jul 2020 11:59:08 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-misc-for-rc0-150720-3: .travis.yml: skip ppc64abi32-linux-user with plugins plugins: expand the bb plugin to be thread safe and track per-cpu cputlb: ensure we save the IOTLB data in case of reset tests/plugins: don't unconditionally add -Wpsabi fpu/softfloat: fix up float16 nan recognition gitlab-ci/containers: Add missing wildcard where we should look for changes docker.py: fix fetching of FROM layers tests/docker: Remove the libssh workaround from the ubuntu 20.04 image docs/devel: fix grammar in multi-thread-tcg Signed-off-by: Peter Maydell <[email protected]>
2 parents f1d5948 + 0571d28 commit dfcade7

File tree

12 files changed

+174
-32
lines changed

12 files changed

+174
-32
lines changed

.gitlab-ci.d/containers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- changes:
2525
- .gitlab-ci.d/containers.yml
2626
- tests/docker/*
27+
- tests/docker/dockerfiles/*
2728
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
2829
- if: '$CI_COMMIT_REF_NAME == "testing/next"'
2930

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,10 @@ jobs:
350350
# Run check-tcg against linux-user (with plugins)
351351
# we skip sparc64-linux-user until it has been fixed somewhat
352352
# we skip cris-linux-user as it doesn't use the common run loop
353+
# we skip ppc64abi32-linux-user as it seems to have a broken libc
353354
- name: "GCC plugins check-tcg (user)"
354355
env:
355-
- CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
356+
- CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
356357
- TEST_BUILD_CMD="make build-tcg"
357358
- TEST_CMD="make check-tcg"
358359
- CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"

accel/tcg/cputlb.c

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,24 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
10731073
return val;
10741074
}
10751075

1076+
/*
1077+
* Save a potentially trashed IOTLB entry for later lookup by plugin.
1078+
*
1079+
* We also need to track the thread storage address because the RCU
1080+
* cleanup that runs when we leave the critical region (the current
1081+
* execution) is actually in a different thread.
1082+
*/
1083+
static void save_iotlb_data(CPUState *cs, hwaddr addr,
1084+
MemoryRegionSection *section, hwaddr mr_offset)
1085+
{
1086+
#ifdef CONFIG_PLUGIN
1087+
SavedIOTLB *saved = &cs->saved_iotlb;
1088+
saved->addr = addr;
1089+
saved->section = section;
1090+
saved->mr_offset = mr_offset;
1091+
#endif
1092+
}
1093+
10761094
static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
10771095
int mmu_idx, uint64_t val, target_ulong addr,
10781096
uintptr_t retaddr, MemOp op)
@@ -1092,6 +1110,12 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
10921110
}
10931111
cpu->mem_io_pc = retaddr;
10941112

1113+
/*
1114+
* The memory_region_dispatch may trigger a flush/resize
1115+
* so for plugins we save the iotlb_data just in case.
1116+
*/
1117+
save_iotlb_data(cpu, iotlbentry->addr, section, mr_offset);
1118+
10951119
if (mr->global_locking && !qemu_mutex_iothread_locked()) {
10961120
qemu_mutex_lock_iothread();
10971121
locked = true;
@@ -1381,8 +1405,11 @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
13811405
* in the softmmu lookup code (or helper). We don't handle re-fills or
13821406
* checking the victim table. This is purely informational.
13831407
*
1384-
* This should never fail as the memory access being instrumented
1385-
* should have just filled the TLB.
1408+
* This almost never fails as the memory access being instrumented
1409+
* should have just filled the TLB. The one corner case is io_writex
1410+
* which can cause TLB flushes and potential resizing of the TLBs
1411+
* loosing the information we need. In those cases we need to recover
1412+
* data from a copy of the io_tlb entry.
13861413
*/
13871414

13881415
bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx,
@@ -1406,8 +1433,13 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx,
14061433
data->v.ram.hostaddr = addr + tlbe->addend;
14071434
}
14081435
return true;
1436+
} else {
1437+
SavedIOTLB *saved = &cpu->saved_iotlb;
1438+
data->is_io = true;
1439+
data->v.io.section = saved->section;
1440+
data->v.io.offset = saved->mr_offset;
1441+
return true;
14091442
}
1410-
return false;
14111443
}
14121444

14131445
#endif

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7115,6 +7115,9 @@ echo "GIT_UPDATE=$git_update" >> $config_host_mak
71157115

71167116
echo "ARCH=$ARCH" >> $config_host_mak
71177117

7118+
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
7119+
echo "GLIB_LDFLAGS=$glib_ldflags" >> $config_host_mak
7120+
71187121
if test "$default_devices" = "yes" ; then
71197122
echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
71207123
else

docs/devel/multi-thread-tcg.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ including:
107107

108108
- debugging operations (breakpoint insertion/removal)
109109
- some CPU helper functions
110-
- linux-user spawning it's first thread
110+
- linux-user spawning its first thread
111111

112112
This is done with the async_safe_run_on_cpu() mechanism to ensure all
113113
vCPUs are quiescent when changes are being made to shared global

fpu/softfloat-specialize.inc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ bool float16_is_quiet_nan(float16 a_, float_status *status)
254254
if (snan_bit_is_one(status)) {
255255
return (((a >> 9) & 0x3F) == 0x3E) && (a & 0x1FF);
256256
} else {
257-
return ((a & ~0x8000) >= 0x7C80);
257+
return ((a >> 9) & 0x3F) == 0x3F;
258258
}
259259
#endif
260260
}
@@ -271,7 +271,7 @@ bool float16_is_signaling_nan(float16 a_, float_status *status)
271271
#else
272272
uint16_t a = float16_val(a_);
273273
if (snan_bit_is_one(status)) {
274-
return ((a & ~0x8000) >= 0x7C80);
274+
return ((a >> 9) & 0x3F) == 0x3F;
275275
} else {
276276
return (((a >> 9) & 0x3F) == 0x3E) && (a & 0x1FF);
277277
}

include/hw/core/cpu.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,18 @@ struct CPUWatchpoint {
259259
QTAILQ_ENTRY(CPUWatchpoint) entry;
260260
};
261261

262+
#ifdef CONFIG_PLUGIN
263+
/*
264+
* For plugins we sometime need to save the resolved iotlb data before
265+
* the memory regions get moved around by io_writex.
266+
*/
267+
typedef struct SavedIOTLB {
268+
hwaddr addr;
269+
MemoryRegionSection *section;
270+
hwaddr mr_offset;
271+
} SavedIOTLB;
272+
#endif
273+
262274
struct KVMState;
263275
struct kvm_run;
264276

@@ -417,7 +429,11 @@ struct CPUState {
417429

418430
DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX);
419431

432+
#ifdef CONFIG_PLUGIN
420433
GArray *plugin_mem_cbs;
434+
/* saved iotlb data from io_writex */
435+
SavedIOTLB saved_iotlb;
436+
#endif
421437

422438
/* TODO Move common fields from CPUArchState here. */
423439
int cpu_index;

include/qemu/typedefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ typedef struct QObject QObject;
116116
typedef struct QString QString;
117117
typedef struct RAMBlock RAMBlock;
118118
typedef struct Range Range;
119+
typedef struct SavedIOTLB SavedIOTLB;
119120
typedef struct SHPCDevice SHPCDevice;
120121
typedef struct SSIBus SSIBus;
121122
typedef struct VirtIODevice VirtIODevice;

tests/docker/docker.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,18 @@ def build_image(self, tag, docker_dir, dockerfile,
306306
checksum = _text_checksum(_dockerfile_preprocess(dockerfile))
307307

308308
if registry is not None:
309-
# see if we can fetch a cache copy, may fail...
310-
pull_args = ["pull", "%s/%s" % (registry, tag)]
311-
if self._do(pull_args, quiet=quiet) == 0:
309+
sources = re.findall("FROM qemu\/(.*)", dockerfile)
310+
# Fetch any cache layers we can, may fail
311+
for s in sources:
312+
pull_args = ["pull", "%s/qemu/%s" % (registry, s)]
313+
if self._do(pull_args, quiet=quiet) != 0:
314+
registry = None
315+
break
316+
# Make substitutions
317+
if registry is not None:
312318
dockerfile = dockerfile.replace("FROM qemu/",
313319
"FROM %s/qemu/" %
314320
(registry))
315-
else:
316-
registry = None
317321

318322
tmp_df = tempfile.NamedTemporaryFile(mode="w+t",
319323
encoding='utf-8',
@@ -339,6 +343,8 @@ def build_image(self, tag, docker_dir, dockerfile,
339343
build_args += ["--build-arg", "BUILDKIT_INLINE_CACHE=1"]
340344

341345
if registry is not None:
346+
pull_args = ["pull", "%s/%s" % (registry, tag)]
347+
self._do(pull_args, quiet=quiet)
342348
cache = "%s/%s" % (registry, tag)
343349
build_args += ["--cache-from", cache]
344350
build_args += argv

tests/docker/dockerfiles/ubuntu2004.docker

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ RUN apt-get update && \
6565
RUN dpkg -l $PACKAGES | sort > /packages.txt
6666
ENV FEATURES clang tsan pyyaml sdl2
6767

68-
# https://bugs.launchpad.net/qemu/+bug/1838763
69-
ENV QEMU_CONFIGURE_OPTS --disable-libssh
70-
7168
# Apply patch https://reviews.llvm.org/D75820
7269
# This is required for TSan in clang-10 to compile with QEMU.
7370
RUN sed -i 's/^const/static const/g' /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h

0 commit comments

Comments
 (0)