Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Analysed and fixed a couple more regressions in my branch. The change to
per-thread target descriptions in gdbserver (which was the more
challenging part) is now free of regressions. Now cleaning up the part
that actually deals with the SVE vector length change.
# Linaro CI's GDB testsuite results
* Increased ccache's max size on most build bots. Sent email to the
linaro-toolchain list summarising the current status of their ccache
setup.
* Started looking more closely into how ccache configuration is put
together in our container scripts to document it on the wiki (together
with the steps I took to change the ccache max size).
--
Thiago
Hello Linaro Toolchain Working Group,
linaro-clang-armv8-lld-2stage <https://lab.llvm.org/buildbot/#/workers/140>
has been red since June 7th.
Is anybody looking at the issue?
Thanks
Galina
Progress: (short week, 3 days)
* UM-2 [QEMU upstream maintainership]
- More code review, as softfreeze is now quite close. I think we've
finally got there with the SME patchset (the remaining problems
with v5 were very minor)
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
- QEMU-315 OS Lock/DoubleLock work now upstream
-- PMM
Hello,
# Linaro CI's GDB testsuite results
* Implemented new version of change in the Abe shell script to correctly
set auto-load-safe-path so that GDB can load libthread_db.so.1. Since
GDB's configure script needs to be passed an argument containing
literal dollar signs, use '@@' instead of '$' to avoid the shell
misinterpreting it and substitute at the point of use. This version
worked and was merged to the Abe repo.
* Implemented and merged change in the Abe shell script to set variables
pointing to language-specific target tools only if they are present in
the path. This fixes Ada test failures in the GDB testsuite.
* Implemented and merged improvement to our tcwg_gnu-build.sh script to
allow specifying on the command line the Abe repo and branch to use.
# [GNU-767] Support changing SVE vector length in remote debugging
* Analysed and fixed a couple more regressions in my branch.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
- Code review (misc, plus another round on the SME patchset)
- KVM Forum programme committee work
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
- Wrote and sent patches that deal with the last of the "small and
uninteresting" dependencies of the V1 support epic (this one covers
Feat_DoubleLock, which lets guest OSes suppress debug events as
part of their power-down-a-CPU sequence)
-- PMM
Hi guys. I just realized that today's meeting will be right in the middle of dinner
plans. I'll organize better next week. Anyway, here's my status:
- Fourth SME patch set -- parts merged, and some bugs fixed.
- Base/arm-compat portion of semihosting rewrite now upstream.
Target-specific bits for m68k, mips, nios2, xtensa outstanding.
- Almost done with FEAT_HAFDBS (hardware access/dirty updates).
Big changes to ptw.c to make that work: 50+ patches.
The reorg should make FEAT_RME easier though.
r~
Hello,
I just noticed that I didn't send a report for week #24. Sorry about
that. For that reason, this report covers two weeks.
# Linaro CI's GDB testsuite results
* Submitted upstream patch fixing gdb_compile regexp to account for our
GNATMAKE_FOR_TARGET value containing spaces. This should solve the Ada
test failures in our CI.
* Fixed the Abe shell script to correctly set auto-load-safe-path so
that GDB can load libthread_db.so.1. Unfortunately the CI detected a
problem with using the generated manifest to reproduce the toolchain
build, so I'm back to the drawing board on this one.
* Sent a Gerrit change request for the Abe script updating it to use
release 12's branch and tag for GDB and gdbserver, and another one
removing a workaround for a build problem fixed in GDB 9.
* Sent a Gerrit change request for tcwg-dev-build.sh fixing a couple of
issues I found when using it to build and test GDB.
# [GNU-767] Support changing SVE vector length in remote debugging
* Analysed and fixed a couple more regressions in my branch.
# Misc
* Attended a few online sessions from Linaro San Francisco Get Together.
* Sent Gerrit change request updating the TCWG script that generates our
SSH known_hosts file to include the Ed25519 host keys, which are now
preferred in Ubuntu 22.04.
* Was out one day due to “Corpus Christi” public holiday.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
- First week back after holiday: lots of catchup
- Good progress with the code review queue, including getting
rid of a few things that had been lurking in it for too
long, and another pass through the latest SME series
- KVM Forum programme committee work
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Debugged and fixed a few issues in my code where gdbserver was having
trouble with setting the target description for new threads. Also
fixed regressions in a couple more testcases.
# Linaro CI's GDB testsuite results
* Luis commented on IRC that the GDB testsuite results from the Linaro CI
seemed a bit high with about 540 failures, so I set out to investigate.
The two biggest sources of failures are:
1. Ada tests were failing because they can't build their test
executables. This is expected because we don't have the Ada compiler
in the CI, but normally these testcases would just bail out as
unsupported. Found out that there was a regex in the GDB testsuite
that was (IMHO) too strict for our particular setup and fixed it.
2. All CTF tests are failing. The compiler in the CI seems to be
building test executables with CTF debug info, so we do seem to have a
problem there.
The CI's GDB is also not loading libthread_db.so because of a GDB
security setting, so I fixed that as well and expect some more tests
to pass now.
I still haven't submitted my fixes for 1. to upstream and for the
libthread_db.so.1 issue to our CI scripts because I'm still working
with jenkins-scripts and Abe to reproduce the CI environment to verify
the fixes.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
- This week was almost entirely code review and similar upstream tasks
- managed to review all the preliminary parts of the SME patchset
- reviewed several other refactoring series from rth
- reviewed a big PS/2 keyboard emulation refactoring patchset
- prep for KVM Forum program committee session
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
- FEAT_RASv1p1 and FEAT_DoubleFault now upstream
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Debugged and fixed issues in my code where gdbserver was in some cases
trying to read inferior registers before aarch64_target was fully
initialised, and also while the inferior thread was running. This
improved reliability but there are still some testsuite regressions to
look into.
# Sourceware bug 28561 - [gdb/testsuite] Error due to not reading \r\n
at end of mi prompt
* Posted comment to the bug report summarising my current results.
* Tried to reproduce the bug using the upstream v5.3 kernel (since I was
able to see it with openSUSE Leap's v5.3 kernel), but failed. Still
trying to understand what that implies.
--
Thiago
Progress (covers two half-weeks):
* UM-2 [QEMU upstream maintainership]
- investigating a reported bug with semihosting syscalls over gdbstub
- reviewed a massive series from RTH refactoring our SVE code
in preparation for handling SME
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
- looking at exactly what FEAT_RASv1p1 and FEAT_DoubleFault require
of a minimal RAS implementation like QEMU's
- sent a patch implementing FEAT_RASv1p1 (a no-op for QEMU)
- sent a patch implementing FEAT_DoubleFault (turns out to be
simpler than I initially feared it might be)
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Found out that one issue I was having with gdbserver was caused by an
incompatibility it has with zsh (sourceware bug 26116).
* Fixed a gdbserver crash in my code where a register set was NULL in
the target description.
* Now working on an issue where the target description says SVE isn't
supported, but the regsets information says they are. This is caused
by my code sometimes moving the first ptrace call to get the inferior
registers to a time before it is properly stopped.
# Sourceware bug 28561 - [gdb/testsuite] Error due to not reading \r\n
at end of mi prompt
* Set up a few containers and KVM guests to attempt to reproduce this
bug on different environments. Reproduced it successfully on an
openSUSE Leap 15.3 guest, as well as Ubuntu 20.04 and 22.04 containers
in said guest. I wasn't able to reproduce on Ubuntu 20.04 nor 22.04
guests. Suspecting it's a kernel issue where the fix was backported to
the Ubuntu kernels.
--
Thiago
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
- Rebased my code on current master branch.
- Ran into issues with running the GDB testsuite against gdbserver, both
on my branch and on master. Currently investigating.
- Regarding the ptrace issues I'm running into, at Richard's suggestion
I checked the errno and it's ESRCH. This means that the inferior isn't
in a state where gdbserver can fetch its registers. So maybe there's
a race condition in gdbserver itself and it's trying to do that before
the inferior is stopped. Currently investigating.
# Sourceware bug 28561 - [gdb/testsuite] Error due to not reading \r\n
at end of mi prompt
* Luis mentioned this bug so I started investigating it. Tried
reproducing it on Ubuntu 20.04 and 22.04 but without success.
Also tried setting up an openSUSE Leap 15.3 KVM guest to try to
reproduce it there, but the distro's installer hangs.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
- Joint Linaro/Arm meeting on the Realm Management Extension (RME).
Mostly this was "how the software stack is going to work"; some
useful discussion on how this intersects with QEMU, both as a
potential emulation platform for software development and also
as the VMM for a realm-using KVM virtual machine.
- Kicked off a discussion thread on getting rid of the last parts
of our "ad-hoc CI" this release cycle. The main thing that's
not yet handled by Gitlab CI is FreeBSD and NetBSD hosts.
We might be able to do this if we can find an x86 Linux machine
to act as a gitlab runner (it needs to be able to run guest
BSD VMs).
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
- Several small features have now made it upstream so those
subtasks have been closed out
- Looking at FEAT_RASv1p1 and FEAT_DoubleFault. The first of these
is easy because we only model the minimal "no error records"
RAS: I think we can simply bump the ID register fields to
indicate support. The second is a little bit more interesting
because the new SCR_EL3.EASE bit means we suddenly have a
source of physical SErrors (from synchronous external aborts)
when we previously could not have any...
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Continued working on the testsuite regressions introduced by my code.
- Found out that the crash I was investigating (which happens when
gdbserver thinks that the kernel doesn't support SVE and crashes)
only occurs with kernel v5.4 from Ubuntu 20.04 and not with
Ubuntu 22.04's v5.15. In the former version,
ptrace(PTRACE_GETREGSET, …, NT_ARM_SVE, …) often returns -1 (but not
always) and gdbserver interprets this as meaning that SVE isn't
supported. The newer kernel always returns successfully from this
call. gdbserver still acts weird so there's more digging to do, but
at least it doesn't crash.
# Misc
- Took one day of vacation.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
+ had a look at adding an option to allow semihosting from
userspace (handy for some test case purposes); have a working
prototype which I used to test the FEAT_IDST patch, but
probably won't pursue further until some refactoring of the
whole semihosting code has landed, to avoid conflicts
+ reading through the Realm Management Extension documentation:
there's a Linaro Kernel Working Group sprint in Cambridge
next week, and possible QEMU RME support is on the agenda
+ back before QEMU 6.0 we tried to fix a bug where QEMU always
provided 4 PMU counters, not the number the emulated CPU really
has. We had to revert that change before the 6.0 release, but
then forgot to go back and revisit it afterwards. Alex
reminded me of it this week, so I rebased it, fixed the problem
that meant it got reverted, and sent it out for review.
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
+ sent patch implementing FEAT_IDST
+ next up: FEAT_DoubleFault (likely a no-op for us, as we don't
ever have physical SErrors)
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Continued working on the testsuite regressions introduced by my code.
- Currently investigating a crash that happens when for some reason
gdbserver thinks that the kernel doesn't support SVE and crashes
while building the internal representation of the regular vector
registers.
# Misc
- Attended Google's Fuchsia boot camp.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
+ tracked down the UEFI crash with KVM on AArch64 to a combination of
(a) host system was heterogenous and user hadn't restricted QEMU to
only running on one set of cores and (b) QEMU silently throws away
the error it gets from KVM in this situation, resulting in most
things seeming to work except that vcpu power on/off state isn't
written to KVM and so the guest starts with all vcpus running
instead of just the primary. We should really improve the error
handling, but I worry that that might break previously functional
setups...
+ tidied up some patches I wrote while doing the GICv4 work that
fix an odd inconsistency in our GIC emulation where we correctly
implement the right number of virtual priority bits for the CPU
but always provide 8 bits of physical priority regardless of what
the real CPU implementation should have, and sent them out for review
+ usual code review and pullreq management
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
+ Implemented support for FEAT_S2FWB and sent patches to the list
+ Next up is probably FEAT_IDST (ID space trap handling)
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Continued working on the testsuite regressions introduced by my code.
- Realised that gdbserver uses “thread->tdesc != NULL” as a proxy of
whether it has already attached to the inferior process. My change to
track the target description per-thread instead of per-process
invalidated this equivalence. Fixed a few places to use “proc->attached”
instead, which is the direct way of testing that condition.
- Now looking into an issue with gdbserver loading libthread_db.so.
# Misc
- Reviewed Tom Tromey's “[PATCH 00/36] C++-ify breakpoints” patch series¹.
Spotted one bug.
--
Thiago
¹ https://sourceware.org/pipermail/gdb-patches/2022-January/185256.html
msgid:20220118194007.2853108-1-tom@tromey.com
Progress:
* UM-2 [QEMU upstream maintainership]
+ investigating a bug report about the guest UEFI crashing on
startup when using KVM on AArch64 with an SMP guest (sadly I haven't
been able to repro it myself thus far)
* QEMU-422 [QEMU Arm Neoverse V1 vCPU for TCG]
+ audited code to check we can enable FEAT_TTL in QEMU (ie we ignore the
new TTL hint field in TLB invalidate operations)
+ audited code to check we can enable FEAT_BBM level 2 in QEMU
(our TLB implementation never allows multiple clashing TLB entries)
+ audited code to check we can enable SMMUv3.2-BBML2 in our SMMUv3
(our SMMU TLB does allow multiple entries but will always select
the one for the lowest level and ignore the others)
+ sent patches to advertise FEAT_TTL, FEAT_BBM, SMMUv3.2-BBML2 in
CPU and SMMU ID registers
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Found and fixed problem with the gdbserver prototype: it didn't clear the
registers cache when the target description changed. The prototype is
working now.
* Turned my attention to the testsuite regressions introduced by my changes.
Fixed one where gdbserver was crashing when debugging multi-threaded
programs, and now investigating one where gdbserver returns an error when
handling the ‘vRun’ remote protocol packet.
# Misc
* Public holiday on Thursday — but I took it on Friday instead.
--
Thiago
Progress (two half-weeks):
* UM-2 [QEMU upstream maintainership]
+ Got the 7.0 release out of the door and handed over pullrequest
processing to RTH for the 7.1 cycle \o/
+ Code review backlog now pretty nearly empty (worked through several
large patchsets from RTH as well as some smaller things)
+ two arm pullreqs for 7.1 sent out already
* QEMU-420 [GICv4 emulation]
+ The GICv4 emulation has now made it through code review and since
we've released 7.0 it is now in upstream git for 7.1
+ The GICv4.1 work has been moved to a new epic QEMU-479, as we're
not going to do that immediately
+ This epic is therefore closed!
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Implemented prototype of GDB and gdbserver changing the target
description in sync when the vg pseudo-register changes. The GDB side
seems to be working, but gdbserver still has issues which I'm
currently debugging.
# Misc
* Public holiday on Friday.
--
Thiago
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Got prototype of variable length vectors in GDB target descriptions
barely working, but fell down a rabbit hole trying to fix an issue
with the vector register size being misreported by ‘sizeof()’. Decided
to change tack and implement the simpler aim of updating the client
and server target descriptions in sync when the vector length changes.
This is Luis' idea from 2020¹, and closer to how native GDB debugging
currently works in this scenario.
--
Thiago
¹ https://sourceware.org/pipermail/gdb/2020-January/048341.html
Progress:
* UM-2 [QEMU upstream maintainership]
+ Finished sorting out the exynos4210 SoC interrupt wiring and sent
a patchset that cleans it up and makes it stop using qemu_split_irq()
+ rc3 tagged this week. We will need an rc4 next week for a couple of
late-breaking security fixes.
* QEMU-420 [GICv4 emulation]
+ Finished the last bits of debugging and wiring up GICv4 support on
the virt board, and sent initial patchset to the list for review:
https://patchew.org/QEMU/20220408141550.1271295-1-peter.maydell@linaro.org/
-- PMM
Hello,
# [GNU-767] Support changing SVE vector length in remote debugging
* Moved tracking of this work from GNU-732 (GDB support for SME) to
more specific story GNU-767.
* Started writing prototype of variable length vectors in GDB target
descriptions.
# Basic setup / onboarding
- Read a couple more Linaro processes documents.
# Misc
* Attended Linaro Connect Tech Day: Core Technologies.
--
Thiago
Project Stratos
===============
- more follow-up on Re: Understanding osdep_xenforeignmemory_map mmap
behaviour Message-Id:
<alpine.DEB.2.22.394.2203231838130.2910984@ubuntu-linux-20-04-desktop>
- various Stratos sync-ups
vhost-device maintainer effort ([UM-196])
- bit of maintainer review work
Linux RPMB Sub-system and virtio-driver ([STR-40])
- got [kernel] and [vhost-user] daemon passing all tests with
multi-block reads/writes
- will clean-up series next week for posting to the lists
[STR-40] <https://linaro.atlassian.net/browse/STR-40>
[kernel]
<https://git.linaro.org/people/alex.bennee/linux.git/tag/?h=testing/vrpmb-re…>
[vhost-user]
<https://github.com/stsquad/qemu/tree/virtio/vhost-user-rpmb-v2>
QEMU Upstream Work ([UM-2])
===========================
- posted [PATCH v1 0/2] some tests and plugin tweaks for SVE
Message-Id: <20220328152614.2452259-1-alex.bennee(a)linaro.org>
- posted [PATCH v3] tests/avocado: update aarch64_virt test to
exercise -cpu max Message-Id:
<20220328161357.2464572-1-alex.bennee(a)linaro.org>
- posted [RFC PATCH] docs/devel: add some notes on the
binfmt-image-debian targets Message-Id:
<20220329095041.2758355-1-alex.bennee(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Other
=====
- Presented [LTD 2022 QEMU talk]
- attneded some others
[LTD 2022 QEMU talk]
<https://resources.linaro.org/en/resource/tL9M2yyti73StqK1d9ap8f>
Completed Reviews [1/1]
=======================
[PATCH 00/15] tests/docker and tests/tcg cleanup and diet
Message-Id: <87czi6xbzo.fsf(a)linaro.org>
Absences
========
Current Review Queue
====================
TODO [PATCH 00/17] tests/docker and tests/tcg cleanup and diet
Message-Id: <20220401141326.1244422-1-pbonzini(a)redhat.com>
========================================================================================================================
TODO [RFC PATCH 0/6] softfloat 128-bit integer support
Message-Id: <20220328201442.175206-1-matheus.ferst(a)eldorado.org.br>
=========================================================================================================================
TODO [PATCH for-7.1 v2 00/39] Logging cleanup and per-thread logfiles
Message-Id: <20220326132534.543738-1-richard.henderson(a)linaro.org>
=======================================================================================================================================
--
Alex Bennée
Progress (short week, 2 days):
* UM-2 [QEMU upstream maintainership]
+ More of the usual freeze-related work
+ Tracked down and fixed assertion when running with clang sanitizers
+ We finally got a Coverity Scan run through for the first time in a
month or two, and it was full of new issues. Spent some time going
through them and marking false positives or reporting the problems
back to original code authors to be fixed
+ Looking at the tangle of interrupt lines in our exynos4210 SoC
model -- this needs a refactoring and cleanup so we can get rid
of its uses of an obsolete function
-- PMM
Hello,
# [GNU-732] GDB support for ARMv9 Scalable Matrix Extension (SME)
* Continued working on gdbserver and remote protocol support for
programs that change the SVE vector length during execution:
- Studied the 2020 discussion around Luis' proposal to support changed
VL size in the Remote Serial Protocol / gdbserver, as well as
relevant parts of the RSP itself.
- Started studying GDB's type system and how it handles dynamic types,
and also the target description code to assess the feasibility of
making the vector registers use a dynamically sized type.
- Luis made a second proposal in that mailing list discussion where
the target description wouldn't be transferred via the remote
protocol, just the vector length. Then both GDB and gdbserver could
locally update their own descriptions based on that. Starting to
think about this alternative. It would probably be simpler than
changing the target description to use a dynamically sized type for
the Z registers.
# Basic setup / onboarding
* Work laptop arrived. Set it up.
--
Thiago
Progress:
* UM-2 [QEMU upstream maintainership]
+ More of the usual freeze-related work
* QEMU-420 [GICv4 emulation]
+ I think the code is more or less bug-free now; still need to
figure out the best way for a board to request a GICv4
(eg do we want a 'revision' property specifying 3, 3.1, 4, 4.1,
or just 3 vs 4 with some optional booleans for extra features?)
-- PMM
Hello,
# [GNU-732] GDB support for ARMv9 Scalable Matrix Extension (SME)
* Continued reading patches from Mark Brown's v12 patch set adding SME
support to the Linux kernel. Sent a few trivial review comments.
* After conversation with Luis, decided to work on gdbserver and remote
protocol support for programs which change the SVE vector length
during execution (native GDB already supports it). This issue will
most likely be relevant for SME as well. Started by studying Luis'
proposal from 2020 and background information provided by him.
# Basic setup / onboarding
* Bought a work laptop.
* Set up access to the team's machines.
--
Thiago
Progress (for a week-and-a-half)
* UM-2 [QEMU upstream maintainership]
+ Lots of freeze-related work (softfreeze was last week and we tagged
rc0 this week)
+ Code review of other peoples's stuff to go into the release
+ Assembling arm pullreqs
+ Investigating an intermittent failure in one of our test cases on
s390 host, which seems like it may be a bug in the s390
h/w-accelerated zlib
* QEMU-420 [GICv4 emulation]
+ Still debugging...
-- PMM
Hello,
I see this release gcc-linaro-4.9-2016.02 for 86_64_arm-linux-gnueabihf:
https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/arm-l…
and would like to reproduce the toolchain for aarch64 hosts. I see that it was built with ABE, though I have generally been unsuccessful in getting ABE to work on aarch64 for this. I was looking for some build or ci breadcrumbs or documentation. What can you recommend?
The motivation here is to support legacy development/testing from modern aarch64 hardware.
Cheers,
Joe Gorse
Hello,
# GDB support for ARMv9 Scalable Matrix Extension (SME)
- Synced with Luis Machado to learn what the current status is. Read
discussions in the linux-arm-kernel mailing list which he pointed to.
- Read Arm architecture documentation about Neon, SVE, SVE2 and SME to
familiarise myself with these features.
- Basic setup / onboarding
- Joined some internal and external mailing lists, IRC and Slack
channels.
- Read some company policy documents.
- Researched models and got a quote for a work laptop.
- Set up aarch64 cross-compilation environment on my laptop.
- Set up emulated aarch64 machine with Fedora on my laptop.
- Attempted setting up emulated aarch64 machine with Ubuntu on my
laptop, but ran into problems with the Ubuntu Server installer.
--
Thiago
Project Stratos
===============
- spent some time talking through design approaches for xen
vhost-master with Viresh
Linux RPMB Sub-system and virtio-driver ([STR-40])
- continued working on [Linux driver]
- discovered a bug in vhost-user config handling in QEMU as well
[STR-40] <https://linaro.atlassian.net/browse/STR-40>
[Linux driver]
<http://git.linaro.org/people/alex.bennee/linux.git/shortlog/refs/heads/rpmb…>
QEMU Upstream Work ([UM-2])
===========================
- posted [PULL 00/18] testing and semihosting updates Message-Id:
<20220301094715.550871-1-alex.bennee(a)linaro.org>
Other
=====
- started work on presentation for LTD
Completed Reviews [5/5]
=======================
[PATCH] gdbstub.c: add support for info proc mappings
Message-Id: <20220221030910.3203063-1-dominik.b.czarnota(a)gmail.com>
[PATCH] tests/Makefile.include: Let "make clean" remove the TCG tests, too
Message-Id: <20220301085900.1443232-1-thuth(a)redhat.com>
[PATCH 0/3] gdbstub: add support for switchable endianness
Message-Id: <20210823142004.17935-1-changbin.du(a)gmail.com>
[PATCH 0/6] More record/replay acceptance tests
Message-Id: <162332427732.194926.7555369160312506539.stgit@pasha-ThinkPad-X280>
[PATCH v6 00/43] CXl 2.0 emulation Support
Message-Id: <20220211120747.3074-1-Jonathan.Cameron(a)huawei.com>
Absences
========
Current Review Queue
====================
TODO [PATCH v4 00/18] target/arm: Implement LVA, LPA, LPA2 features
Message-Id: <20220301215958.157011-1-richard.henderson(a)linaro.org>
=====================================================================================================================================
TODO [RFC PATCH 00/27] Virtio sound card implementation
Message-Id: <20210429120445.694420-1-chouhan.shreyansh2702(a)gmail.com>
============================================================================================================================
TODO [PATCH v4 00/41] linux-user: Streamline handling of SIGSEGV
Message-Id: <20211006172307.780893-1-richard.henderson(a)linaro.org>
==================================================================================================================================
--
Alex Bennée
Progress
* UM-2 [QEMU upstream maintainership]
+ Looked at and sent patches to fix a minor decode error for Neon
VLD1/VST1 that RTH found
+ softfreeze is next Tuesday -- sent out last big Arm pullreq before
freeze, though there will probably need to be another smaller one
+ code review, respinning previously sent patches, looking at bug
reports, all to get things in before freeze
* QEMU-420 [GICv4 emulation]
+ All the GICv4.0 stuff is now code-complete, but testing and
loose ends (like plumbing it into the virt board) will take a
while still.
-- PMM
Progress:
* UM-2 [QEMU upstream maintainership]
+ Respins of a few patchsets that needed v2
+ Looked at a few bugs since softfreeze for 7.0 is near
+ Amazingly my to-review queue is now almost empty
* QEMU-420 [GICv4 emulation]
+ Implemented more of the redistributor code -- the last missing
big piece is its handling of VMOVI, though there are also probably
some loose ends to tidy up
+ Note that this isn't going to be in time for 7.0, so will likely
go on the back-burner a bit in favour of release-critical items
thanks
-- PMM
Project Stratos
===============
- spent more time troubleshooting Xen builds with Viresh
Linux RPMB Sub-system and virtio-driver ([STR-40])
- continued working on [Linux driver]
- discovered a bug in vhost-user config handling in QEMU as well
[STR-40] <https://linaro.atlassian.net/browse/STR-40>
[Linux driver]
<http://git.linaro.org/people/alex.bennee/linux.git/shortlog/refs/heads/rpmb…>
QEMU Upstream Work ([UM-2])
===========================
- follow-up on Analysis of slow distro boots in check-avocado
(BootLinuxAarch64.test_virt_tcg*) Message-Id:
<874k4xbqvp.fsf(a)linaro.org>
- posted [PATCH v2 00/18] testing and semihosting pre-PR Message-Id:
<20220225172021.3493923-1-alex.bennee(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Current Review Queue
====================
TODO [RFC PATCH 00/27] Virtio sound card implementation
Message-Id: <20210429120445.694420-1-chouhan.shreyansh2702(a)gmail.com>
============================================================================================================================
TODO [PATCH v6 00/43] CXl 2.0 emulation Support
Message-Id: <20220211120747.3074-1-Jonathan.Cameron(a)huawei.com>
==============================================================================================================
TODO [PATCH v2 00/15] target/arm: Implement LVA, LPA, LPA2 features
Message-Id: <20220210040423.95120-1-richard.henderson(a)linaro.org>
====================================================================================================================================
--
Alex Bennée
Project Stratos
===============
- spent more time troubleshooting Xen builds with Viresh
Linux RPMB Sub-system and virtio-driver ([STR-40])
- started working on v2 of the Linux driver
QEMU Upstream Work ([UM-2])
===========================
- posted Analysis of slow distro boots in check-avocado
(BootLinuxAarch64.test_virt_tcg*) Message-Id:
<874k4xbqvp.fsf(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Current Review Queue
====================
TODO [RFC PATCH 00/27] Virtio sound card implementation
Message-Id: <20210429120445.694420-1-chouhan.shreyansh2702(a)gmail.com>
============================================================================================================================
TODO [PATCH v6 00/43] CXl 2.0 emulation Support
Message-Id: <20220211120747.3074-1-Jonathan.Cameron(a)huawei.com>
==============================================================================================================
TODO [PATCH v2 00/15] target/arm: Implement LVA, LPA, LPA2 features
Message-Id: <20220210040423.95120-1-richard.henderson(a)linaro.org>
====================================================================================================================================
--
Alex Bennée
Progress (a report covering two half-weeks)
* UM-2 [QEMU upstream maintainership]
- lots of code review
- fixed another bug in the armv7m clock framework code
- refactoring patchset to trim some fat from a header that
gets included by every C file in the build
* QEMU-420 [GICv4 emulation]
- CPU interface parts of GICv4 work are code-complete
- started on the redistributor work
-- PMM
Project Stratos
===============
- posted [RFC PATCH] tests/qtest: attempt to enable tests for
virtio-gpio (!working) Message-Id:
<20220121151534.3654562-1-alex.bennee(a)linaro.org>
- need to increase coverage of the QEMU boilerplate to get it merged
- discussions on next steps with SCMI backend with Vincent (moving
from the QEMU->QEMU PoC)
QEMU Upstream Work ([UM-2])
===========================
- posted [PATCH v2 00/25] testing and plugin updates Message-Id:
<20220201182050.15087-1-alex.bennee(a)linaro.org>
- posted [RFC PATCH 0/4] improve coverage of vector backend
Message-Id: <20220202191242.652607-2-alex.bennee(a)linaro.org>
- posted [PATCH v3 00/26] testing and plugins pre-PR Message-Id:
<20220204204335.1689602-1-alex.bennee(a)linaro.org>
- posted [RFC PATCH] arm: force flag recalculation when messing with
DAIF Message-Id: <20220202122353.457084-1-alex.bennee(a)linaro.org>
- trying to track down a weird TLS bug:
<https://gitlab.com/stsquad/qemu/-/jobs/2056025874#L3532>
- on aarch64 HW, running qemu-s390x with a simple test case fails
every 100/200 times
- seems TLS memory gets made non-accessible (rw-p -> ---p, except to
gdb)
- strace doesn't show a culprit, possible kernel bug?
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- still waiting final review of [kvm-unit-tests PATCH v9 0/9] MTTCG
sanity tests for ARM Message-Id:
<20211202115352.951548-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
Other
=====
- planning and brainstorming for Linaro Tech Day
Completed Reviews [5/5]
=======================
[PATCH v4 00/42] CXl 2.0 emulation Support
Message-Id: <20220124171705.10432-1-Jonathan.Cameron(a)huawei.com>
[PATCH] gitlab: fall back to commit hash in qemu-setup filename
Message-Id: <20220125173454.10381-1-stefanha(a)redhat.com>
[PATCH for-7.0] gitlab-ci: Add cirrus-ci based tests for NetBSD and OpenBSD
Message-Id: <20211209103124.121942-1-thuth(a)redhat.com>
[PATCH 00/20] tcg: vector improvements
Message-Id: <20211218194250.247633-1-richard.henderson(a)linaro.org>
Absences
========
Current Review Queue
====================
TODO [PATCH 0/4] target/arm: SVE fixes versus VHE
Message-Id: <20220127063428.30212-1-richard.henderson(a)linaro.org>
==================================================================================================================
TODO [PATCH 00/14] arm_gicv3_its: Implement MOVI and MOVALL commands
Message-Id: <20220122182444.724087-1-peter.maydell(a)linaro.org>
==================================================================================================================================
TODO [PATCH v11 0/8] hmp,qmp: Add commands to introspect virtio devices
Message-Id: <1642678168-20447-1-git-send-email-jonah.palmer(a)oracle.com>
==============================================================================================================================================
TODO [PATCH v2 00/13] arm gicv3 ITS: Various bug fixes and refactorings
Message-Id: <20220111171048.3545974-1-peter.maydell(a)linaro.org>
======================================================================================================================================
--
Alex Bennée
Progress:
* UM-2 [QEMU upstream maintainership]
- Fixed some minor issues with the hvf accelerator and sent out a patchset
+ '-cpu max' didn't act like '-cpu host'
+ we weren't exposing PAuth to the guest
* QEMU-420 [GICv4 emulation]
- Sent out a patchset with more cleanups and fixes to the existing ITS code
- The ITS parts of the GICv4 work are now code-complete; moving on to
the redistributor end of things next week.
-- PMM
Progress:
* UM-2 [QEMU upstream maintainership]
- Before the QEMU 7.0 release we tried to land a bug fix which corrected
the handling in our PSCI emulation of calls where the function ID
is unrecognized -- these are supposed to return an error code.
The bugfix turned out to cause regressions for some boards when
running guest code at EL3 (because those boards were incorrectly
enabling PSCI emulation in that situation). Sent a patchset that
fixed those boards so we don't enable PSCI when running EL3 guests,
and re-introduced the original PSCI bugfix.
- Fixed various bugs in the highbank/midway boards discovered in
the process of writing and testing the above patchset. (These
two boards were the most complicated to fix.)
- More code review, and sent out an arm pullrequest
- Small handful of other minor patches
-- PMM
Seems like my change to make Clang default to DWARFv5 might've caused a
buildbot failure on your build worker here:
https://lab.llvm.org/buildbot/#/builders/185/builds/1295
But I seem to be able to run this test successfully locally on my Linux
machine - so I'm wondering if you can offer any help diagnosing the issue
showing up on your builder/worker?
Project Stratos
===============
- [RFC PATCH] tests/qtest: attempt to enable tests for virtio-gpio
(!working) Message-Id:
<20220121151534.3654562-1-alex.bennee(a)linaro.org>
- trying to clear the way for merging virtio-gpio to QEMU
vhost-device maintainer effort ([UM-196])
- reviewed vhost-device [pr7 with the vm-virtio vsock abstraction]
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
[pr7 with the vm-virtio vsock abstraction]
<https://github.com/stsquad/vhost-device/tree/review/pr7-with-laurat-abstrac…>
QEMU Upstream Work ([UM-2])
===========================
- posted [PULL v2 00/31] testing/next and other misc fixes Message-Id:
<20220118190043.1427303-1-alex.bennee(a)linaro.org>
Upstream MTTCG tests ([QEMU-52])
- still waiting final review of [kvm-unit-tests PATCH v9 0/9] MTTCG
sanity tests for ARM Message-Id:
<20211202115352.951548-1-alex.bennee(a)linaro.org>
Completed Reviews [2/2]
=======================
[PATCH v2 00/13] arm gicv3 ITS: Various bug fixes and refactorings
Message-Id: <20220111171048.3545974-1-peter.maydell(a)linaro.org>
[PATCH v2 0/6] qtests/libqos: Allow PCI tests to be run with virt-machine
Message-Id: <20220118203833.316741-7-eric.auger(a)redhat.com>
Absences
========
Current Review Queue
====================
TODO [PATCH v11 0/8] hmp,qmp: Add commands to introspect virtio devices
Message-Id: <1642678168-20447-1-git-send-email-jonah.palmer(a)oracle.com>
==============================================================================================================================================
TODO [PATCH v2 00/13] arm gicv3 ITS: Various bug fixes and refactorings
Message-Id: <20220111171048.3545974-1-peter.maydell(a)linaro.org>
======================================================================================================================================
TODO [PATCH v2 00/11] Atomic cleanup + clang-12 build fix
Message-Id: <20210717014121.1784956-1-richard.henderson(a)linaro.org>
============================================================================================================================
TODO [PATCH 0/7] tcg: some small towards more modular tcg
Message-Id: <20210804143826.3402872-1-kraxel(a)redhat.com>
=================================================================================================================
--
Alex Bennée
Progress:
* UM-2 [QEMU upstream maintainership]
- Sent patches for some reported bugs to do with state save/load
* QEMU-420 [GICv4 emulation]
- Wrote patches to implement the missing MOVALL and MOVI commands
- Fixed a few minor bugs noticed along the way
- Should be able to send out a patchset early next week and then can
get back to the new-in-GICv4 work
-- PMM
[TCWG CI] Regression caused by gcc: Add -Wdangling-pointer [PR63272].:
commit 9d6a0f388eb048f8d87f47af78f07b5ce513bfe6
Author: Martin Sebor <msebor(a)redhat.com>
Add -Wdangling-pointer [PR63272].
Results regressed to
# reset_artifacts:
-10
# build_abe binutils:
-9
# build_abe stage1:
-5
# build_abe qemu:
-2
# linux_n_obj:
21324
# First few build errors in logs:
# 00:03:31 sound/core/oss/mixer_oss.c:1057:21: error: ‘slot’ is used uninitialized [-Werror=uninitialized]
# 00:03:32 sound/core/oss/pcm_oss.c:108:29: error: ‘t’ is used uninitialized [-Werror=uninitialized]
# 00:03:32 sound/core/oss/pcm_oss.c:2488:34: error: ‘setup’ is used uninitialized [-Werror=uninitialized]
# 00:03:32 sound/core/oss/pcm_oss.c:2998:51: error: ‘template’ is used uninitialized [-Werror=uninitialized]
# 00:03:35 make[3]: *** [scripts/Makefile.build:277: sound/core/oss/mixer_oss.o] Error 1
# 00:03:35 sound/core/seq/oss/seq_oss_init.c:350:35: error: ‘qinfo’ is used uninitialized [-Werror=uninitialized]
# 00:03:35 sound/core/seq/oss/seq_oss_init.c:370:35: error: ‘qinfo’ is used uninitialized [-Werror=uninitialized]
# 00:03:36 make[4]: *** [scripts/Makefile.build:277: sound/core/seq/oss/seq_oss_init.o] Error 1
# 00:03:40 make[3]: *** [scripts/Makefile.build:277: sound/core/oss/pcm_oss.o] Error 1
# 00:03:50 make[3]: *** [scripts/Makefile.build:540: sound/core/seq/oss] Error 2
from
# reset_artifacts:
-10
# build_abe binutils:
-9
# build_abe stage1:
-5
# build_abe qemu:
-2
# linux_n_obj:
21354
THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.
This commit has regressed these CI configurations:
- tcwg_kernel/gnu-master-aarch64-stable-allmodconfig
First_bad build: https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-…
Last_good build: https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-…
Baseline build: https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-…
Even more details: https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-…
Reproduce builds:
<cut>
mkdir investigate-gcc-9d6a0f388eb048f8d87f47af78f07b5ce513bfe6
cd investigate-gcc-9d6a0f388eb048f8d87f47af78f07b5ce513bfe6
# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts
# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-… --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-… --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_kernel-gnu-bisect-gnu-master-aarch64-stable-… --fail
chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_kernel-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/
cd gcc
# Reproduce first_bad build
git checkout --detach 9d6a0f388eb048f8d87f47af78f07b5ce513bfe6
../artifacts/test.sh
# Reproduce last_good build
git checkout --detach 671a283636de75f7ed638ee6b01ed2d44361b8b6
../artifacts/test.sh
cd ..
</cut>
Full commit (up to 1000 lines):
<cut>
commit 9d6a0f388eb048f8d87f47af78f07b5ce513bfe6
Author: Martin Sebor <msebor(a)redhat.com>
Date: Sat Jan 15 16:41:40 2022 -0700
Add -Wdangling-pointer [PR63272].
Resolves:
PR c/63272 - GCC should warn when using pointer to dead scoped variable with
in the same function
gcc/c-family/ChangeLog:
PR c/63272
* c.opt (-Wdangling-pointer): New option.
gcc/ChangeLog:
PR c/63272
* diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle
-Wdangling-pointer.
* doc/invoke.texi (-Wdangling-pointer): Document new option.
* gimple-ssa-warn-access.cc (pass_waccess::clone): Set new member.
(pass_waccess::check_pointer_uses): New function.
(pass_waccess::gimple_call_return_arg): New function.
(pass_waccess::gimple_call_return_arg_ref): New function.
(pass_waccess::check_call_dangling): New function.
(pass_waccess::check_dangling_uses): New function overloads.
(pass_waccess::check_dangling_stores): New function.
(pass_waccess::check_dangling_stores): New function.
(pass_waccess::m_clobbers): New data member.
(pass_waccess::m_func): New data member.
(pass_waccess::m_run_number): New data member.
(pass_waccess::m_check_dangling_p): New data member.
(pass_waccess::check_alloca): Check m_early_checks_p.
(pass_waccess::check_alloc_size_call): Same.
(pass_waccess::check_strcat): Same.
(pass_waccess::check_strncat): Same.
(pass_waccess::check_stxcpy): Same.
(pass_waccess::check_stxncpy): Same.
(pass_waccess::check_strncmp): Same.
(pass_waccess::check_memop_access): Same.
(pass_waccess::check_read_access): Same.
(pass_waccess::check_builtin): Call check_pointer_uses.
(pass_waccess::warn_invalid_pointer): Add arguments.
(is_auto_decl): New function.
(pass_waccess::check_stmt): New function.
(pass_waccess::check_block): Call check_stmt.
(pass_waccess::execute): Call check_dangling_uses,
check_dangling_stores. Empty m_clobbers.
* passes.def (pass_warn_access): Invoke pass two more times.
gcc/testsuite/ChangeLog:
PR c/63272
* g++.dg/warn/Wfree-nonheap-object-6.C: Disable valid warnings.
* g++.dg/warn/ref-temp1.C: Prune expected warning.
* gcc.dg/uninit-pr50476.c: Expect a new warning.
* c-c++-common/Wdangling-pointer-2.c: New test.
* c-c++-common/Wdangling-pointer-3.c: New test.
* c-c++-common/Wdangling-pointer-4.c: New test.
* c-c++-common/Wdangling-pointer-5.c: New test.
* c-c++-common/Wdangling-pointer-6.c: New test.
* c-c++-common/Wdangling-pointer.c: New test.
* g++.dg/warn/Wdangling-pointer-2.C: New test.
* g++.dg/warn/Wdangling-pointer.C: New test.
* gcc.dg/Wdangling-pointer-2.c: New test.
* gcc.dg/Wdangling-pointer.c: New test.
---
gcc/c-family/c.opt | 8 +
gcc/diagnostic-spec.c | 1 +
gcc/doc/invoke.texi | 62 +-
gcc/gimple-ssa-warn-access.cc | 635 +++++++++++++++++++--
gcc/passes.def | 5 +-
gcc/testsuite/c-c++-common/Wdangling-pointer-2.c | 437 ++++++++++++++
gcc/testsuite/c-c++-common/Wdangling-pointer-3.c | 64 +++
gcc/testsuite/c-c++-common/Wdangling-pointer-4.c | 73 +++
gcc/testsuite/c-c++-common/Wdangling-pointer-5.c | 90 +++
gcc/testsuite/c-c++-common/Wdangling-pointer-6.c | 32 ++
gcc/testsuite/c-c++-common/Wdangling-pointer.c | 434 ++++++++++++++
gcc/testsuite/g++.dg/warn/Wdangling-pointer-2.C | 23 +
gcc/testsuite/g++.dg/warn/Wdangling-pointer.C | 74 +++
gcc/testsuite/g++.dg/warn/Wfree-nonheap-object-6.C | 4 +-
gcc/testsuite/g++.dg/warn/ref-temp1.C | 3 +
gcc/testsuite/gcc.dg/Wdangling-pointer-2.c | 82 +++
gcc/testsuite/gcc.dg/Wdangling-pointer.c | 75 +++
gcc/testsuite/gcc.dg/uninit-pr50476.c | 2 +-
18 files changed, 2043 insertions(+), 61 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 28363643664..db65c14a7a5 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -548,6 +548,14 @@ Wdangling-else
C ObjC C++ ObjC++ Var(warn_dangling_else) Warning LangEnabledBy(C ObjC C++ ObjC++,Wparentheses)
Warn about dangling else.
+Wdangling-pointer
+C ObjC C++ LTO ObjC++ Alias(Wdangling-pointer=, 2, 0) Warning
+Warn for uses of pointers to auto variables whose lifetime has ended.
+
+Wdangling-pointer=
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_dangling_pointer) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 2, 0) IntegerRange(0, 2)
+Warn for uses of pointers to auto variables whose lifetime has ended.
+
Wdate-time
C ObjC C++ ObjC++ CPP(warn_date_time) CppReason(CPP_W_DATE_TIME) Var(cpp_warn_date_time) Init(0) Warning
Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage.
diff --git a/gcc/diagnostic-spec.c b/gcc/diagnostic-spec.c
index c9e1c1be91d..a8af229d677 100644
--- a/gcc/diagnostic-spec.c
+++ b/gcc/diagnostic-spec.c
@@ -99,6 +99,7 @@ nowarn_spec_t::nowarn_spec_t (opt_code opt)
m_bits = NW_UNINIT;
break;
+ case OPT_Wdangling_pointer_:
case OPT_Wreturn_local_addr:
case OPT_Wuse_after_free_:
m_bits = NW_DANGLING;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 121c8ea827f..7f2205e4a85 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -341,7 +341,8 @@ Objective-C and Objective-C++ Dialects}.
-Wchar-subscripts @gol
-Wclobbered -Wcomment @gol
-Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
--Wdangling-else -Wdate-time @gol
+-Wdangling-else -Wdangling-pointer -Wdangling-pointer=@var{n} @gol
+-Wdate-time @gol
-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
-Wdisabled-optimization @gol
-Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
@@ -4389,6 +4390,8 @@ Warn about overriding virtual functions that are not marked with the
@opindex Wno-use-after-free
Warn about uses of pointers to dynamically allocated objects that have
been rendered indeterminate by a call to a deallocation function.
+The warning is enabled at all optimization levels but may yield different
+results with optimization than without.
@table @gcctabopt
@item -Wuse-after-free=1
@@ -5714,6 +5717,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
-Wcatch-value @r{(C++ and Objective-C++ only)} @gol
-Wchar-subscripts @gol
-Wcomment @gol
+-Wdangling-pointer=2 @gol
-Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
-Wformat @gol
@@ -8587,6 +8591,62 @@ looks like this:
This warning is enabled by @option{-Wparentheses}.
+@item -Wdangling-pointer
+@itemx -Wdangling-pointer=@var{n}
+@opindex Wdangling-pointer
+@opindex Wno-dangling-pointer
+Warn about uses of pointers (or C++ references) to objects with automatic
+storage duration after their lifetime has ended. This includes local
+variables declared in nested blocks, compound literals and other unnamed
+temporary objects. In addition, warn about storing the address of such
+objects in escaped pointers. The warning is enabled at all optimization
+levels but may yield different results with optimization than without.
+
+@table @gcctabopt
+@item -Wdangling-pointer=1
+At level 1 the warning diagnoses only unconditional uses of dangling pointers.
+For example
+@smallexample
+int f (int c1, int c2, x)
+@{
+ char *p = strchr ((char[])@{ c1, c2 @}, c3);
+ return p ? *p : 'x'; // warning: dangling pointer to a compound literal
+@}
+@end smallexample
+In the following function the store of the address of the local variable
+@code{x} in the escaped pointer @code{*p} also triggers the warning.
+@smallexample
+void g (int **p)
+@{
+ int x = 7;
+ *p = &x; // warning: storing the address of a local variable in *p
+@}
+@end smallexample
+
+@item -Wdangling-pointer=2
+At level 2, in addition to unconditional uses the warning also diagnoses
+conditional uses of dangling pointers.
+
+For example, because the array @var{a} in the following function is out of
+scope when the pointer @var{s} that was set to point is used, the warning
+triggers at this level.
+
+@smallexample
+void f (char *s)
+@{
+ if (!s)
+ @{
+ char a[12] = "tmpname";
+ s = a;
+ @}
+ strcat (s, ".tmp"); // warning: dangling pointer to a may be used
+ ...
+@}
+@end smallexample
+@end table
+
+@option{-Wdangling-pointer=2} is included in @option{-Wall}.
+
@item -Wdate-time
@opindex Wdate-time
@opindex Wno-date-time
diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc
index 882129143a1..f639807a78a 100644
--- a/gcc/gimple-ssa-warn-access.cc
+++ b/gcc/gimple-ssa-warn-access.cc
@@ -2069,10 +2069,12 @@ class pass_waccess : public gimple_opt_pass
~pass_waccess ();
- opt_pass *clone () { return new pass_waccess (m_ctxt); }
+ opt_pass *clone ();
virtual bool gate (function *);
+ void set_pass_param (unsigned, bool);
+
virtual unsigned int execute (function *);
private:
@@ -2089,6 +2091,9 @@ private:
/* Check a call to an ordinary function for invalid accesses. */
bool check_call_access (gcall *);
+ /* Check a non-call statement. */
+ void check_stmt (gimple *);
+
/* Check statements in a basic block. */
void check_block (basic_block);
@@ -2112,26 +2117,41 @@ private:
void check_atomic_memmodel (gimple *, tree, tree, const unsigned char *);
/* Check for uses of indeterminate pointers. */
- void check_pointer_uses (gimple *, tree);
+ void check_pointer_uses (gimple *, tree, tree = NULL_TREE, bool = false);
/* Return the argument that a call returns. */
tree gimple_call_return_arg (gcall *);
+ tree gimple_call_return_arg_ref (gcall *);
+
+ /* Check a call for uses of a dangling pointer arguments. */
+ void check_call_dangling (gcall *);
+
+ /* Check uses of a dangling pointer or those derived from it. */
+ void check_dangling_uses (tree, tree, bool = false, bool = false);
+ void check_dangling_uses ();
+ void check_dangling_stores ();
+ void check_dangling_stores (basic_block, hash_set<tree> &, auto_bitmap &);
- void warn_invalid_pointer (tree, gimple *, gimple *, bool, bool = false);
+ void warn_invalid_pointer (tree, gimple *, gimple *, tree, bool, bool = false);
/* Return true if use follows an invalidating statement. */
- bool use_after_inval_p (gimple *, gimple *);
+ bool use_after_inval_p (gimple *, gimple *, bool = false);
/* A pointer_query object and its cache to store information about
pointers and their targets in. */
pointer_query m_ptr_qry;
pointer_query::cache_type m_var_cache;
-
+ /* Mapping from DECLs and their clobber statements in the function. */
+ hash_map<tree, gimple *> m_clobbers;
/* A bit is set for each basic block whose statements have been assigned
valid UIDs. */
bitmap m_bb_uids_set;
/* The current function. */
function *m_func;
+ /* True to run checks for uses of dangling pointers. */
+ bool m_check_dangling_p;
+ /* True to run checks early on in the optimization pipeline. */
+ bool m_early_checks_p;
};
/* Construct the pass. */
@@ -2140,11 +2160,22 @@ pass_waccess::pass_waccess (gcc::context *ctxt)
: gimple_opt_pass (pass_data_waccess, ctxt),
m_ptr_qry (NULL, &m_var_cache),
m_var_cache (),
+ m_clobbers (),
m_bb_uids_set (),
- m_func ()
+ m_func (),
+ m_check_dangling_p (),
+ m_early_checks_p ()
{
}
+/* Return a copy of the pass with RUN_NUMBER one greater than THIS. */
+
+opt_pass*
+pass_waccess::clone ()
+{
+ return new pass_waccess (m_ctxt);
+}
+
/* Release pointer_query cache. */
pass_waccess::~pass_waccess ()
@@ -2152,6 +2183,14 @@ pass_waccess::~pass_waccess ()
m_ptr_qry.flush_cache ();
}
+void
+pass_waccess::set_pass_param (unsigned int n, bool early)
+{
+ gcc_assert (n == 0);
+
+ m_early_checks_p = early;
+}
+
/* Return true when any checks performed by the pass are enabled. */
bool
@@ -2340,6 +2379,9 @@ maybe_warn_alloc_args_overflow (gimple *stmt, const tree args[2],
void
pass_waccess::check_alloca (gcall *stmt)
{
+ if (m_early_checks_p)
+ return;
+
if ((warn_vla_limit >= HOST_WIDE_INT_MAX
&& warn_alloc_size_limit < warn_vla_limit)
|| (warn_alloca_limit >= HOST_WIDE_INT_MAX
@@ -2361,6 +2403,13 @@ pass_waccess::check_alloca (gcall *stmt)
void
pass_waccess::check_alloc_size_call (gcall *stmt)
{
+ if (m_early_checks_p)
+ return;
+
+ if (gimple_call_num_args (stmt) < 1)
+ /* Avoid invalid calls to functions without a prototype. */
+ return;
+
tree fndecl = gimple_call_fndecl (stmt);
if (fndecl && gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
{
@@ -2413,6 +2462,9 @@ pass_waccess::check_alloc_size_call (gcall *stmt)
void
pass_waccess::check_strcat (gcall *stmt)
{
+ if (m_early_checks_p)
+ return;
+
if (!warn_stringop_overflow && !warn_stringop_overread)
return;
@@ -2438,6 +2490,9 @@ pass_waccess::check_strcat (gcall *stmt)
void
pass_waccess::check_strncat (gcall *stmt)
{
+ if (m_early_checks_p)
+ return;
+
if (!warn_stringop_overflow && !warn_stringop_overread)
return;
@@ -2507,6 +2562,9 @@ pass_waccess::check_strncat (gcall *stmt)
void
pass_waccess::check_stxcpy (gcall *stmt)
{
+ if (m_early_checks_p)
+ return;
+
tree dst = call_arg (stmt, 0);
tree src = call_arg (stmt, 1);
@@ -2545,7 +2603,7 @@ pass_waccess::check_stxcpy (gcall *stmt)
void
pass_waccess::check_stxncpy (gcall *stmt)
{
- if (!warn_stringop_overflow)
+ if (m_early_checks_p || !warn_stringop_overflow)
return;
tree dst = call_arg (stmt, 0);
@@ -2569,7 +2627,7 @@ pass_waccess::check_stxncpy (gcall *stmt)
void
pass_waccess::check_strncmp (gcall *stmt)
{
- if (!warn_stringop_overread)
+ if (m_early_checks_p || !warn_stringop_overread)
return;
tree arg1 = call_arg (stmt, 0);
@@ -2674,6 +2732,9 @@ pass_waccess::check_strncmp (gcall *stmt)
void
pass_waccess::check_memop_access (gimple *stmt, tree dest, tree src, tree size)
{
+ if (m_early_checks_p)
+ return;
+
/* For functions like memset and memcpy that operate on raw memory
try to determine the size of the largest source and destination
object using type-0 Object Size regardless of the object size
@@ -2695,7 +2756,7 @@ pass_waccess::check_read_access (gimple *stmt, tree src,
tree bound /* = NULL_TREE */,
int ost /* = 1 */)
{
- if (!warn_stringop_overread)
+ if (m_early_checks_p || !warn_stringop_overread)
return;
if (bound && !useless_type_conversion_p (size_type_node, TREE_TYPE (bound)))
@@ -2938,7 +2999,7 @@ pass_waccess::check_atomic_memmodel (gimple *stmt, tree ord_sucs,
if (warning_suppressed_p (stmt, OPT_Winvalid_memory_model))
return;
- if (maybe_warn_memmodel (stmt, ord_sucs, ord_fail, valid))
+ if (!maybe_warn_memmodel (stmt, ord_sucs, ord_fail, valid))
return;
suppress_warning (stmt, OPT_Winvalid_memory_model);
@@ -3094,11 +3155,12 @@ pass_waccess::check_builtin (gcall *stmt)
case BUILT_IN_FREE:
case BUILT_IN_REALLOC:
- {
- tree arg = call_arg (stmt, 0);
- if (TREE_CODE (arg) == SSA_NAME)
- check_pointer_uses (stmt, arg);
- }
+ if (!m_early_checks_p)
+ {
+ tree arg = call_arg (stmt, 0);
+ if (TREE_CODE (arg) == SSA_NAME)
+ check_pointer_uses (stmt, arg);
+ }
return true;
case BUILT_IN_GETTEXT:
@@ -3725,16 +3787,67 @@ pass_waccess::maybe_check_dealloc_call (gcall *call)
/* Return true if either USE_STMT's basic block (that of a pointer's use)
is dominated by INVAL_STMT's (that of a pointer's invalidating statement,
- or if they're in the same block, USE_STMT follows INVAL_STMT. */
+ which is either a clobber or a deallocation call), or if they're in
+ the same block, USE_STMT follows INVAL_STMT. */
bool
-pass_waccess::use_after_inval_p (gimple *inval_stmt, gimple *use_stmt)
+pass_waccess::use_after_inval_p (gimple *inval_stmt, gimple *use_stmt,
+ bool last_block /* = false */)
{
+ tree clobvar =
+ gimple_clobber_p (inval_stmt) ? gimple_assign_lhs (inval_stmt) : NULL_TREE;
+
basic_block inval_bb = gimple_bb (inval_stmt);
basic_block use_bb = gimple_bb (use_stmt);
+ if (!inval_bb || !use_bb)
+ return false;
+
if (inval_bb != use_bb)
- return dominated_by_p (CDI_DOMINATORS, use_bb, inval_bb);
+ {
+ if (dominated_by_p (CDI_DOMINATORS, use_bb, inval_bb))
+ return true;
+
+ if (!clobvar || !last_block)
+ return false;
+
+ /* Proceed only when looking for uses of dangling pointers. */
+ auto gsi = gsi_for_stmt (use_stmt);
+
+ auto_bitmap visited;
+
+ /* A use statement in the last basic block in a function or one that
+ falls through to it is after any other prior clobber of the used
+ variable unless it's followed by a clobber of the same variable. */
+ basic_block bb = use_bb;
+ while (bb != inval_bb
+ && single_succ_p (bb)
+ && !(single_succ_edge (bb)->flags & (EDGE_EH|EDGE_DFS_BACK)))
+ {
+ if (!bitmap_set_bit (visited, bb->index))
+ /* Avoid cycles. */
+ return true;
+
+ for (; !gsi_end_p (gsi); gsi_next_nondebug (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ if (gimple_clobber_p (stmt))
+ {
+ if (clobvar == gimple_assign_lhs (stmt))
+ /* The use is followed by a clobber. */
+ return false;
+ }
+ }
+
+ bb = single_succ (bb);
+ gsi = gsi_start_bb (bb);
+ }
+
+ /* The use is one of a dangling pointer if a clobber of the variable
+ [the pointer points to] has not been found before the function exit
+ point. */
+ return bb == EXIT_BLOCK_PTR_FOR_FN (cfun);
+ }
if (bitmap_set_bit (m_bb_uids_set, inval_bb->index))
/* The first time this basic block is visited assign increasing ids
@@ -3752,27 +3865,30 @@ pass_waccess::use_after_inval_p (gimple *inval_stmt, gimple *use_stmt)
return gimple_uid (inval_stmt) < gimple_uid (use_stmt);
}
-/* Issue a warning for the USE_STMT of pointer PTR rendered invalid
- by INVAL_STMT. PTR may be null when it's been optimized away.
- MAYBE is true to issue the "maybe" kind of warning. EQUALITY is
- true when the pointer is used in an equality expression. */
+/* Issue a warning for the USE_STMT of pointer or reference REF rendered
+ invalid by INVAL_STMT. REF may be null when it's been optimized away.
+ When nonnull, INVAL_STMT is the deallocation function that rendered
+ the pointer or reference dangling. Otherwise, VAR is the auto variable
+ (including an unnamed temporary such as a compound literal) whose
+ lifetime's rended it dangling. MAYBE is true to issue the "maybe"
+ kind of warning. EQUALITY is true when the pointer is used in
+ an equality expression. */
void
-pass_waccess::warn_invalid_pointer (tree ptr, gimple *use_stmt,
- gimple *inval_stmt,
- bool maybe,
- bool equality /* = false */)
+pass_waccess::warn_invalid_pointer (tree ref, gimple *use_stmt,
+ gimple *inval_stmt, tree var,
+ bool maybe, bool equality /* = false */)
{
/* Avoid printing the unhelpful "<unknown>" in the diagnostics. */
- if (ptr && TREE_CODE (ptr) == SSA_NAME
- && (!SSA_NAME_VAR (ptr) || DECL_ARTIFICIAL (SSA_NAME_VAR (ptr))))
- ptr = NULL_TREE;
+ if (ref && TREE_CODE (ref) == SSA_NAME
+ && (!SSA_NAME_VAR (ref) || DECL_ARTIFICIAL (SSA_NAME_VAR (ref))))
+ ref = NULL_TREE;
location_t use_loc = gimple_location (use_stmt);
if (use_loc == UNKNOWN_LOCATION)
{
- use_loc = cfun->function_end_locus;
- if (!ptr)
+ use_loc = m_func->function_end_locus;
+ if (!ref)
/* Avoid issuing a warning with no context other than
the function. That would make it difficult to debug
in any but very simple cases. */
@@ -3788,12 +3904,12 @@ pass_waccess::warn_invalid_pointer (tree ptr, gimple *use_stmt,
const tree inval_decl = gimple_call_fndecl (inval_stmt);
- if ((ptr && warning_at (use_loc, OPT_Wuse_after_free,
+ if ((ref && warning_at (use_loc, OPT_Wuse_after_free,
(maybe
? G_("pointer %qE may be used after %qD")
: G_("pointer %qE used after %qD")),
- ptr, inval_decl))
- || (!ptr && warning_at (use_loc, OPT_Wuse_after_free,
+ ref, inval_decl))
+ || (!ref && warning_at (use_loc, OPT_Wuse_after_free,
(maybe
? G_("pointer may be used after %qD")
: G_("pointer used after %qD")),
@@ -3805,6 +3921,52 @@ pass_waccess::warn_invalid_pointer (tree ptr, gimple *use_stmt,
}
return;
}
+
+ if ((maybe && warn_dangling_pointer < 2)
+ || warning_suppressed_p (use_stmt, OPT_Wdangling_pointer_))
+ return;
+
+ if (DECL_NAME (var))
+ {
+ if ((ref
+ && warning_at (use_loc, OPT_Wdangling_pointer_,
+ (maybe
+ ? G_("dangling pointer %qE to %qD may be used")
+ : G_("using dangling pointer %qE to %qD")),
+ ref, var))
+ || (!ref
+ && warning_at (use_loc, OPT_Wdangling_pointer_,
+ (maybe
+ ? G_("dangling pointer to %qD may be used")
+ : G_("using a dangling pointer to %qD")),
+ var)))
+ inform (DECL_SOURCE_LOCATION (var),
+ "%qD declared here", var);
+ suppress_warning (use_stmt, OPT_Wdangling_pointer_);
+ return;
+ }
+
+ if ((ref
+ && warning_at (use_loc, OPT_Wdangling_pointer_,
+ (maybe
+ ? G_("dangling pointer %qE to an unnamed temporary "
+ "may be used")
+ : G_("using dangling pointer %qE to an unnamed "
+ "temporary")),
+ ref, var))
+ || (!ref
+ && warning_at (use_loc, OPT_Wdangling_pointer_,
+ (maybe
+ ? G_("dangling pointer to an unnamed temporary "
+ "may be used")
+ : G_("using a dangling pointer to an unnamed "
+ "temporary")),
+ var)))
+ {
+ inform (DECL_SOURCE_LOCATION (var),
+ "unnamed temporary defined here");
+ suppress_warning (use_stmt, OPT_Wdangling_pointer_);
+ }
}
/* If STMT is a call to either the standard realloc or to a user-defined
@@ -3927,10 +4089,14 @@ pointers_related_p (gimple *stmt, tree p, tree q, pointer_query &qry)
/* For a STMT either a call to a deallocation function or a clobber, warn
for uses of the pointer PTR it was called with (including its copies
- or others derived from it by pointer arithmetic). */
+ or others derived from it by pointer arithmetic). If STMT is a clobber,
+ VAR is the decl of the clobbered variable. When MAYBE is true use
+ a "maybe" form of diagnostic. */
void
-pass_waccess::check_pointer_uses (gimple *stmt, tree ptr)
+pass_waccess::check_pointer_uses (gimple *stmt, tree ptr,
+ tree var /* = NULL_TREE */,
+ bool maybe /* = false */)
{
gcc_assert (TREE_CODE (ptr) == SSA_NAME);
@@ -4013,18 +4179,25 @@ pass_waccess::check_pointer_uses (gimple *stmt, tree ptr)
/* Warn if USE_STMT is dominated by the deallocation STMT.
Otherwise, add the pointer to POINTERS so that the uses
of any other pointers derived from it can be checked. */
- if (use_after_inval_p (stmt, use_stmt))
+ if (use_after_inval_p (stmt, use_stmt, check_dangling))
{
- /* TODO: Handle PHIs but careful of false positives. */
- if (gimple_code (use_stmt) != GIMPLE_PHI)
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
- basic_block use_bb = gimple_bb (use_stmt);
- bool this_maybe
- = !dominated_by_p (CDI_POST_DOMINATORS, use_bb, stmt_bb);
- warn_invalid_pointer (*use_p->use, use_stmt, stmt,
- this_maybe, equality);
- continue;
+ tree lhs = gimple_phi_result (use_stmt);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ pointers.safe_push (lhs);
+ continue;
+ }
}
+
+ basic_block use_bb = gimple_bb (use_stmt);
+ bool this_maybe
+ = (maybe
+ || !dominated_by_p (CDI_POST_DOMINATORS, use_bb, stmt_bb));
+ warn_invalid_pointer (*use_p->use, use_stmt, stmt, var,
+ this_maybe, equality);
+ continue;
}
if (is_gimple_assign (use_stmt))
@@ -4059,26 +4232,100 @@ pass_waccess::check_call (gcall *stmt)
if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
check_builtin (stmt);
- if (tree callee = gimple_call_fndecl (stmt))
- {
- /* Check for uses of the pointer passed to either a standard
- or a user-defined deallocation function. */
- unsigned argno = fndecl_dealloc_argno (callee);
- if (argno < (unsigned) call_nargs (stmt))
- {
- tree arg = call_arg (stmt, argno);
- if (TREE_CODE (arg) == SSA_NAME)
- check_pointer_uses (stmt, arg);
- }
- }
+ if (!m_early_checks_p)
+ if (tree callee = gimple_call_fndecl (stmt))
+ {
+ /* Check for uses of the pointer passed to either a standard
+ or a user-defined deallocation function. */
+ unsigned argno = fndecl_dealloc_argno (callee);
+ if (argno < (unsigned) call_nargs (stmt))
+ {
+ tree arg = call_arg (stmt, argno);
+ if (TREE_CODE (arg) == SSA_NAME)
+ check_pointer_uses (stmt, arg);
+ }
+ }
check_call_access (stmt);
+ check_call_dangling (stmt);
+
+ if (m_early_checks_p)
+ return;
maybe_check_dealloc_call (stmt);
check_nonstring_args (stmt);
}
+/* Return true of X is a DECL with automatic storage duration. */
+
+static inline bool
+is_auto_decl (tree x)
+{
+ return DECL_P (x) && !DECL_EXTERNAL (x) && !TREE_STATIC (x);
+}
+
+/* Check non-call STMT for invalid accesses. */
+
+void
+pass_waccess::check_stmt (gimple *stmt)
+{
+ if (m_check_dangling_p && gimple_clobber_p (stmt))
+ {
+ /* Ignore clobber statemts in blocks with exceptional edges. */
+ basic_block bb = gimple_bb (stmt);
+ edge e = EDGE_PRED (bb, 0);
+ if (e->flags & EDGE_EH)
+ return;
+
+ tree var = gimple_assign_lhs (stmt);
+ m_clobbers.put (var, stmt);
+ return;
+ }
+
+ if (is_gimple_assign (stmt))
+ {
+ /* Clobbered unnamed temporaries such as compound literals can be
+ revived. Check for an assignment to one and remove it from
+ M_CLOBBERS. */
+ tree lhs = gimple_assign_lhs (stmt);
+ while (handled_component_p (lhs))
+ lhs = TREE_OPERAND (lhs, 0);
+
+ if (is_auto_decl (lhs))
+ m_clobbers.remove (lhs);
+ return;
+ }
+
+ if (greturn *ret = dyn_cast <greturn *> (stmt))
+ {
+ if (optimize && flag_isolate_erroneous_paths_dereference)
+ /* Avoid interfering with -Wreturn-local-addr (which runs only
+ with optimization enabled). */
+ return;
+
+ tree arg = gimple_return_retval (ret);
+ if (!arg || TREE_CODE (arg) != ADDR_EXPR)
+ return;
+
+ arg = TREE_OPERAND (arg, 0);
+ while (handled_component_p (arg))
+ arg = TREE_OPERAND (arg, 0);
+
+ if (!is_auto_decl (arg))
+ return;
+
+ gimple **pclobber = m_clobbers.get (arg);
+ if (!pclobber)
+ return;
+
+ if (!use_after_inval_p (*pclobber, stmt))
+ return;
+
+ warn_invalid_pointer (NULL_TREE, stmt, *pclobber, arg, false);
+ }
+}
+
/* Check basic block BB for invalid accesses. */
void
@@ -4091,6 +4338,8 @@ pass_waccess::check_block (basic_block bb)
gimple *stmt = gsi_stmt (si);
if (gcall *call = dyn_cast <gcall *> (stmt))
check_call (call);
+ else
+ check_stmt (stmt);
}
}
@@ -4139,6 +4388,262 @@ pass_waccess::gimple_call_return_arg (gcall *call)
return gimple_call_arg (call, argno);
}
+/* Return the decl referenced by the argument that the call STMT to
+ a built-in function returns (including with an offset) or null if
+ it doesn't. */
+
+tree
+pass_waccess::gimple_call_return_arg_ref (gcall *call)
+{
+ if (tree arg = gimple_call_return_arg (call))
+ {
+ access_ref aref;
+ if (m_ptr_qry.get_ref (arg, call, &aref, 0)
+ && DECL_P (aref.ref))
+ return aref.ref;
+ }
+
+ return NULL_TREE;
+}
+
+/* Check for and diagnose all uses of the dangling pointer VAR to the auto
+ object DECL whose lifetime has ended. OBJREF is true when VAR denotes
+ an access to a DECL that may have been clobbered. */
+
+void
+pass_waccess::check_dangling_uses (tree var, tree decl, bool maybe /* = false */,
+ bool objref /* = false */)
+{
+ if (!decl || !is_auto_decl (decl))
+ return;
+
+ gimple **pclob = m_clobbers.get (decl);
+ if (!pclob)
+ return;
+
+ if (!objref)
+ {
+ check_pointer_uses (*pclob, var, decl, maybe);
+ return;
+ }
+
+ gimple *use_stmt = SSA_NAME_DEF_STMT (var);
+ if (!use_after_inval_p (*pclob, use_stmt, true))
+ return;
+
+ basic_block use_bb = gimple_bb (use_stmt);
+ basic_block clob_bb = gimple_bb (*pclob);
+ maybe = maybe || !dominated_by_p (CDI_POST_DOMINATORS, use_bb, clob_bb);
+ warn_invalid_pointer (var, use_stmt, *pclob, decl, maybe, false);
+}
+
+/* Diagnose stores in BB and (recursively) its predecessors of the addresses
+ of local variables into nonlocal pointers that are left dangling after
+ the function returns. BBS is a bitmap of basic blocks visited. */
+
+void
+pass_waccess::check_dangling_stores (basic_block bb,
+ hash_set<tree> &stores,
+ auto_bitmap &bbs)
+{
+ if (!bitmap_set_bit (bbs, bb->index))
+ /* Avoid cycles. */
+ return;
+
+ /* Iterate backwards over the statements looking for a store of
+ the address of a local variable into a nonlocal pointer. */
+ for (auto gsi = gsi_last_nondebug_bb (bb); ; gsi_prev_nondebug (&gsi))
+ {
+ gimple *stmt = gsi_stmt (gsi);
+ if (!stmt)
+ break;
+
+ if (is_gimple_call (stmt)
+ && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
+ /* Avoid looking before nonconst, nonpure calls since those might
+ use the escaped locals. */
+ return;
+
+ if (!is_gimple_assign (stmt) || gimple_clobber_p (stmt))
+ continue;
+
+ access_ref lhs_ref;
+ tree lhs = gimple_assign_lhs (stmt);
+ if (!m_ptr_qry.get_ref (lhs, stmt, &lhs_ref, 0))
+ continue;
+
+ if (is_auto_decl (lhs_ref.ref))
+ continue;
+
+ if (DECL_P (lhs_ref.ref))
+ {
+ if (!POINTER_TYPE_P (TREE_TYPE (lhs_ref.ref))
+ || lhs_ref.deref > 0)
+ continue;
+ }
+ else if (TREE_CODE (lhs_ref.ref) == SSA_NAME)
+ {
+ /* Avoid looking at or before stores into unknown objects. */
+ gimple *def_stmt = SSA_NAME_DEF_STMT (lhs_ref.ref);
+ if (!gimple_nop_p (def_stmt))
+ return;
+ }
+ else if (TREE_CODE (lhs_ref.ref) == MEM_REF)
+ {
+ tree arg = TREE_OPERAND (lhs_ref.ref, 0);
+ if (TREE_CODE (arg) == SSA_NAME)
+ {
+ gimple *def_stmt = SSA_NAME_DEF_STMT (arg);
+ if (!gimple_nop_p (def_stmt))
+ return;
+ }
+ }
+ else
+ continue;
+
+ if (stores.add (lhs_ref.ref))
+ continue;
+
+ /* FIXME: Handle stores of alloca() and VLA. */
+ access_ref rhs_ref;
+ tree rhs = gimple_assign_rhs1 (stmt);
+ if (!m_ptr_qry.get_ref (rhs, stmt, &rhs_ref, 0)
+ || rhs_ref.deref != -1)
+ continue;
+
+ if (!is_auto_decl (rhs_ref.ref))
+ continue;
+
+ location_t loc = gimple_location (stmt);
+ if (warning_at (loc, OPT_Wdangling_pointer_,
+ "storing the address of local variable %qD in %qE",
+ rhs_ref.ref, lhs))
+ {
+ location_t loc = DECL_SOURCE_LOCATION (rhs_ref.ref);
+ inform (loc, "%qD declared here", rhs_ref.ref);
+
+ if (DECL_P (lhs_ref.ref))
+ loc = DECL_SOURCE_LOCATION (lhs_ref.ref);
+ else if (EXPR_HAS_LOCATION (lhs_ref.ref))
+ loc = EXPR_LOCATION (lhs_ref.ref);
+
+ if (loc != UNKNOWN_LOCATION)
+ inform (loc, "%qE declared here", lhs_ref.ref);
+ }
+ }
+
+ edge e;
+ edge_iterator ei;
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ basic_block pred = e->src;
+ check_dangling_stores (pred, stores, bbs);
+ }
+}
+
+/* Diagnose stores of the addresses of local variables into nonlocal
+ pointers that are left dangling after the function returns. */
+
+void
+pass_waccess::check_dangling_stores ()
+{
+ auto_bitmap bbs;
+ hash_set<tree> stores;
+ check_dangling_stores (EXIT_BLOCK_PTR_FOR_FN (m_func), stores, bbs);
+}
+
+/* Check for and diagnose uses of dangling pointers to auto objects
+ whose lifetime has ended. */
+
+void
+pass_waccess::check_dangling_uses ()
+{
+ tree var;
+ unsigned i;
+ FOR_EACH_SSA_NAME (i, var, m_func)
+ {
+ /* For each SSA_NAME pointer VAR find the DECL it points to.
+ If the DECL is a clobbered local variable, check to see
+ if any of VAR's uses (or those of other pointers derived
+ from VAR) happens after the clobber. If so, warn. */
+ tree decl = NULL_TREE;
+
+ gimple *def_stmt = SSA_NAME_DEF_STMT (var);
+ if (is_gimple_assign (def_stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (def_stmt);
+ if (TREE_CODE (rhs) == ADDR_EXPR)
+ {
+ if (!POINTER_TYPE_P (TREE_TYPE (var)))
+ continue;
+ decl = TREE_OPERAND (rhs, 0);
+ }
+ else
+ {
+ /* For other expressions, check the base DECL to see
+ if it's been clobbered, most likely as a result of
</cut>
Project Stratos
===============
- reviewed Peter's virtio-video patches for QEMU
[PR to clean up some typos in EDK2]
<https://github.com/tianocore/edk2-platforms/pull/34>
vhost-device maintainer effort ([UM-196])
- started reviewing https://github.com/rust-vmm/vhost-device/pull/7
- looking pretty good, see how
https://github.com/rust-vmm/vm-virtio/commit/463dd20552fc32139bbbb56e9152df…
would work with it
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
QEMU Upstream Work ([UM-2])
===========================
- posted [RFC PATCH 0/6] Basic skeleton of RP2040 Raspbery Pi Pico
Message-Id: <20220110175104.2908956-1-alex.bennee(a)linaro.org>
- posted [PATCH v1 00/34] testing/next and other misc fixes
Message-Id: <20220105135009.1584676-1-alex.bennee(a)linaro.org>
- and the eventual [PULL 00/31] testing/next and other misc fixes
Message-Id: <20220112112722.3641051-1-alex.bennee(a)linaro.org>
- and the inevitable fixup [RFC PATCH] linux-user: expand reserved
brk space for 64bit guests Message-Id:
<20220113165550.4184455-1-alex.bennee(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- still waiting final review of [kvm-unit-tests PATCH v9 0/9] MTTCG
sanity tests for ARM Message-Id:
<20211202115352.951548-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
Completed Reviews [6/6]
=======================
[PATCH] tests/docker: Add gentoo-loongarch64-cross image and run cross builds in GitLab
Message-Id: <20211229062204.3726981-1-git(a)xen0n.name>
[PATCH 0/2] tests/tcg: Fix float_{convs,madds}
Message-Id: <20211224035541.2159966-1-richard.henderson(a)linaro.org>
[PATCH v5 00/18] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles
Message-Id: <20211215141949.3512719-1-berrange(a)redhat.com>
[PATCH] tests/tcg: Unconditionally use 90 second timeout
Message-Id: <20211230235424.49155-1-richard.henderson(a)linaro.org>
[PATCH] gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices
Message-Id: <20211216082253.43899-1-thuth(a)redhat.com>
[PATCH 0/8] virtio: Add vhost-user based Video decode
Message-Id: <20211209145601.331477-1-peter.griffin(a)linaro.org>
Absences
========
Current Review Queue
====================
TODO [PATCH v2 00/11] Atomic cleanup + clang-12 build fix
Message-Id: <20210717014121.1784956-1-richard.henderson(a)linaro.org>
============================================================================================================================
TODO [PATCH 0/7] tcg: some small towards more modular tcg
Message-Id: <20210804143826.3402872-1-kraxel(a)redhat.com>
=================================================================================================================
TODO [PATCH 0/6] Introduce CanoKey QEMU
Message-Id: <YcSupUSXWDXOAkas@Sun>
=========================================================================
TODO [PATCH] target/arm: Add missing FEAT_TLBIOS instructions
Message-Id: <20211231103928.1455657-1-idan.horowitz(a)gmail.com>
===========================================================================================================================
--
Alex Bennée
Project Stratos
===============
- reviewed Peter's virtio-video patches for QEMU
[PR to clean up some typos in EDK2]
<https://github.com/tianocore/edk2-platforms/pull/34>
vhost-device maintainer effort ([UM-196])
- started reviewing https://github.com/rust-vmm/vhost-device/pull/7
- looking pretty good, see how
https://github.com/rust-vmm/vm-virtio/commit/463dd20552fc32139bbbb56e9152df…
would work with it
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
QEMU Upstream Work ([UM-2])
===========================
- posted [RFC PATCH 0/6] Basic skeleton of RP2040 Raspbery Pi Pico
Message-Id: <20220110175104.2908956-1-alex.bennee(a)linaro.org>
- posted [PATCH v1 00/34] testing/next and other misc fixes
Message-Id: <20220105135009.1584676-1-alex.bennee(a)linaro.org>
- and the eventual [PULL 00/31] testing/next and other misc fixes
Message-Id: <20220112112722.3641051-1-alex.bennee(a)linaro.org>
- and the inevitable fixup [RFC PATCH] linux-user: expand reserved
brk space for 64bit guests Message-Id:
<20220113165550.4184455-1-alex.bennee(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- still waiting final review of [kvm-unit-tests PATCH v9 0/9] MTTCG
sanity tests for ARM Message-Id:
<20211202115352.951548-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
Completed Reviews [6/6]
=======================
[PATCH] tests/docker: Add gentoo-loongarch64-cross image and run cross builds in GitLab
Message-Id: <20211229062204.3726981-1-git(a)xen0n.name>
[PATCH 0/2] tests/tcg: Fix float_{convs,madds}
Message-Id: <20211224035541.2159966-1-richard.henderson(a)linaro.org>
[PATCH v5 00/18] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles
Message-Id: <20211215141949.3512719-1-berrange(a)redhat.com>
[PATCH] tests/tcg: Unconditionally use 90 second timeout
Message-Id: <20211230235424.49155-1-richard.henderson(a)linaro.org>
[PATCH] gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices
Message-Id: <20211216082253.43899-1-thuth(a)redhat.com>
[PATCH 0/8] virtio: Add vhost-user based Video decode
Message-Id: <20211209145601.331477-1-peter.griffin(a)linaro.org>
Absences
========
Current Review Queue
====================
TODO [PATCH 0/6] Introduce CanoKey QEMU
Message-Id: <YcSupUSXWDXOAkas@Sun>
=========================================================================
TODO [PATCH] target/arm: Add missing FEAT_TLBIOS instructions
Message-Id: <20211231103928.1455657-1-idan.horowitz(a)gmail.com>
========================================================================================================================
TODO [PATCH-4.16 v2] xen/efi: Fix Grub2 boot on arm64
Message-Id: <20211104141206.25153-1-luca.fancellu(a)arm.com>
===============================================================================================================
--
Alex Bennée
Progress:
* UM-2 [QEMU upstream maintainership]
- Most of this week was spent on continuing to work through
my code-review queue :-/
- Sent a few minor cleanup patches for linux-user nits I noticed while
reading the code as part of reviewing a big bsd-user patchset
* QEMU-420 [GICv4 emulation]
- got some reviewed ITS cleanup patches upstream
- rerolled and sent v2 patchset for the rest of the cleanup patches
- got back up to speed with where I left my GICv4 ITS patches
before Christmas, and dealt with some minor loose ends I'd
left in the last patch or two I was working on.
-- PMM
Hi Peter,
Welcome back, hope you had a good Christmas break. I'm off oh holiday myself for the next
two weeks, so this would be an ideal time to pass back merge control to you.
The board is mostly green now, with occasional allowed failures for centos-stream and
freebsd for upstream package manager failures.
See yall in a couple of weeks.
r~
[UM-2]
* Re-greening of gitlab-ci.
- There are continuing issues with cross-i386-tci.
Occasionally I see *really* long test times:
https://gitlab.com/qemu-project/qemu/-/jobs/1941996332
with qtest-aarch64/qom-test taking 1738s, or 28 of the 60 minute budget.
More often it's merely slow:
https://gitlab.com/qemu-project/qemu/-/jobs/1954634840
with qtest-aarch64/qom-test taking 538s. Note that locally this test
runs in about 100s, and I have been unable to determine why it runs so
much slower on gitlab.
- Worked on a ppc64-softmmu slowdown leading to timeouts.
- Fixes for meson regressions affecting testing.
* Refresh tcg unaligned user patch sets.
r~
Progress (short week, 2 days):
* UM-2 [QEMU upstream maintainership]
- Catching up with email and codereview backlog from 3 weeks holiday :-)
(Have got the codereview queue down to less than a dozen things
so should be able to do some more GICv4 development next week.)
-- PMM
Project Stratos
===============
- got Xen working on the MachiatoBin
- posted Configuring the host GIC for guest to guest IPI Message-Id:
<87fsqwn2sd.fsf(a)linaro.org>
QEMU Upstream Work ([UM-2])
===========================
- posted [RFC PATCH] linux-user: don't adjust base of found hole
Message-Id: <20211216144442.2270605-1-alex.bennee(a)linaro.org>
- posted [PATCH] hw/arm: add control knob to disable kaslr_seed via
DTB Message-Id: <20211215120926.1696302-1-alex.bennee(a)linaro.org>
Completed Reviews [3/3]
=======================
[PATCH 00/26] arm gicv3 ITS: Various bug fixes and refactorings
Message-Id: <20211211191135.1764649-1-peter.maydell(a)linaro.org>
[PATCH for-7.0 0/6] target/arm: Implement LVA, LPA, LPA2 features
Message-Id: <20211208231154.392029-1-richard.henderson(a)linaro.org>
[PATCH-for-6.2? v2 0/5] docs/devel/style: Improve rST rendering
Message-Id: <20211118145716.4116731-1-philmd(a)redhat.com>
Absences
========
Off for holidays, back in the new year. Merry Christmas everyone!
--
Alex Bennée
Project Stratos
===============
- posted Potential demo setup for a TSN/XDP networking Message-Id:
<87wnkfkp2f.fsf(a)linaro.org>
- final Stratos call of the year
- CC and Arnd will look at fat virtq
- nice update from EPAM on Zephyr
- had another round of getting working ACPI on MachiatoBin
- posted [PR to clean up some typos in EDK2]
- might have a working Xen setup without needing SMC hacks
[PR to clean up some typos in EDK2]
<https://github.com/tianocore/edk2-platforms/pull/34>
vhost-device maintainer effort ([UM-196])
- finished review of https://github.com/rust-vmm/vhost-device/pull/4
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
QEMU Upstream Work ([UM-2])
===========================
- discussion around Suggestions for TCG performance improvements
Message-Id: <c76bde31-8f3b-2d03-b7c7-9e026d4b5873(a)huawei.com>
- did a bunch of bug triage and tagging
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- awaiting final review of [kvm-unit-tests PATCH v9 0/9] MTTCG sanity
tests for ARM Message-Id:
<20211202115352.951548-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
Completed Reviews [3/3]
=======================
[PATCH] tests/plugin/syscall.c: fix compiler warnings
Message-Id: <20211128011551.2115468-1-juro.bystricky(a)intel.com>
[PATCH for-6.2? 0/2] arm_gicv3: Fix handling of LPIs in list registers
Message-Id: <20211126163915.1048353-2-peter.maydell(a)linaro.org>
[PATCH] tests/docker: add libfuse3 development headers
Message-Id: <20211207160025.52466-1-stefanha(a)redhat.com>
Absences
========
Current Review Queue
====================
TODO [PATCH 0/8] virtio: Add vhost-user based Video decode
Message-Id: <20211209145601.331477-1-peter.griffin(a)linaro.org>
========================================================================================================================
TODO [PATCH for-7.0 0/6] target/arm: Implement LVA, LPA, LPA2 features
Message-Id: <20211208231154.392029-1-richard.henderson(a)linaro.org>
========================================================================================================================================
TODO [PATCH-4.16 v2] xen/efi: Fix Grub2 boot on arm64
Message-Id: <20211104141206.25153-1-luca.fancellu(a)arm.com>
===============================================================================================================
TODO [PATCH 00/16] fdt: Make OF_BOARD a boolean option
Message-Id: <20211013010120.96851-1-sjg(a)chromium.org>
===========================================================================================================
--
Alex Bennée
Progress:
* UM-2 [QEMU upstream maintainership]
- More code review: now have a target-arm.next poised and ready to
send once 6.2 is released
* QEMU-420 [GICv4 emulation]
- Working on the ITS changes needed for GICv4 support (this turns
out to be a more tractable end to start than the redistributor)
- I have a preliminary set of 25 or so patches to the ITS which
clean up the code and fix some pre-existing bugs that I found
while working on the GICv4 changes
- have implemented the new VMAPI, VMAPTI, VMAPP ITS commands
-- PMM
After llvm commit 3d549dddf75b6ff9e0ec8c053677750bde4226ea
Author: Sander de Smalen <sander.desmalen(a)arm.com>
[LV] Pass compare predicate to getCmpSelInstrCost.
the following benchmarks slowed down by more than 2%:
- 464.h264ref slowed down by 7% from 11115 to 11846 perf samples
Below reproducer instructions can be used to re-build both "first_bad" and "last_good" cross-toolchains used in this bisection. Naturally, the scripts will fail when triggerring benchmarking jobs if you don't have access to Linaro TCWG CI.
For your convenience, we have uploaded tarballs with pre-processed source and assembly files at:
- First_bad save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
- Last_good save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
- Baseline save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Configuration:
- Benchmark: SPEC CPU2006
- Toolchain: Clang + Glibc + LLVM Linker
- Version: all components were built from their tip of trunk
- Target: aarch64-linux-gnu
- Compiler flags: -O2 -flto
- Hardware: NVidia TX1 4x Cortex-A57
This benchmarking CI is work-in-progress, and we welcome feedback and suggestions at linaro-toolchain(a)lists.linaro.org . In our improvement plans is to add support for SPEC CPU2017 benchmarks and provide "perf report/annotate" data behind these reports.
THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.
This commit has regressed these CI configurations:
- tcwg_bmk_llvm_tx1/llvm-master-aarch64-spec2k6-O2_LTO
First_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Baseline build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Even more details: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Reproduce builds:
<cut>
mkdir investigate-llvm-3d549dddf75b6ff9e0ec8c053677750bde4226ea
cd investigate-llvm-3d549dddf75b6ff9e0ec8c053677750bde4226ea
# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts
# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /llvm/ ./ ./bisect/baseline/
cd llvm
# Reproduce first_bad build
git checkout --detach 3d549dddf75b6ff9e0ec8c053677750bde4226ea
../artifacts/test.sh
# Reproduce last_good build
git checkout --detach ab31d003e16e483bff298ea2f28fec0f23e8eb79
../artifacts/test.sh
cd ..
</cut>
Full commit (up to 1000 lines):
<cut>
commit 3d549dddf75b6ff9e0ec8c053677750bde4226ea
Author: Sander de Smalen <sander.desmalen(a)arm.com>
Date: Mon Dec 6 11:14:27 2021 +0000
[LV] Pass compare predicate to getCmpSelInstrCost.
If the condition of a select is a compare, pass its predicate to
TTI::getCmpSelInstrCost to get a more accurate cost value instead
of passing BAD_ICMP_PREDICATE.
I noticed that the commit message from D90070 had a comment about the
vectorized select predicate possibly being composed of other compares with
different predicate values, but I wasn't able to construct an example
where this was an actual issue. If this is an issue, I guess we could
add another check that the block isn't predicated for any reason.
Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D114646
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 11 ++++++++---
llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll | 14 +++++++-------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 050879144afd..c03e506b7474 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7570,8 +7570,12 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
Type *CondTy = SI->getCondition()->getType();
if (!ScalarCond)
CondTy = VectorType::get(CondTy, VF);
- return TTI.getCmpSelInstrCost(I->getOpcode(), VectorTy, CondTy,
- CmpInst::BAD_ICMP_PREDICATE, CostKind, I);
+
+ CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
+ if (auto *Cmp = dyn_cast<CmpInst>(SI->getCondition()))
+ Pred = Cmp->getPredicate();
+ return TTI.getCmpSelInstrCost(I->getOpcode(), VectorTy, CondTy, Pred,
+ CostKind, I);
}
case Instruction::ICmp:
case Instruction::FCmp: {
@@ -7581,7 +7585,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
ValTy = IntegerType::get(ValTy->getContext(), MinBWs[Op0AsInstruction]);
VectorTy = ToVectorTy(ValTy, VF);
return TTI.getCmpSelInstrCost(I->getOpcode(), VectorTy, nullptr,
- CmpInst::BAD_ICMP_PREDICATE, CostKind, I);
+ cast<CmpInst>(I)->getPredicate(), CostKind,
+ I);
}
case Instruction::Store:
case Instruction::Load: {
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
index 62b18f44fbc5..20d2dc0b7cda 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
@@ -5,17 +5,17 @@ target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios5.0.0"
define void @selects_1(i32* nocapture %dst, i32 %A, i32 %B, i32 %C, i32 %N) {
-; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
-; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
-; CHECK: LV: Found an estimated cost of 5 for VF 2 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
+; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
+; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
+; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
-; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
-; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
-; CHECK: LV: Found an estimated cost of 13 for VF 4 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
+; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond = select i1 %cmp1, i32 10, i32 %and
+; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond6 = select i1 %cmp2, i32 30, i32 %and
+; CHECK: LV: Found an estimated cost of 1 for VF 4 For instruction: %cond11 = select i1 %cmp7, i32 %cond, i32 %cond6
; CHECK-LABEL: define void @selects_1(
; CHECK: vector.body:
-; CHECK: select <2 x i1>
+; CHECK: select <4 x i1>
entry:
%cmp26 = icmp sgt i32 %N, 0
</cut>
Dear Linaro Toolchain Working Group,
clang-thumbv7-full-2stage is red for 20 days.
Could you take it to the staging area and make it green again, please?
Thanks
Galina
After llvm commit bd4c6a476fd037fb07a1c484f75d93ee40713d3d
Author: David Blaikie <dblaikie(a)gmail.com>
Add missing header
the following benchmarks slowed down by more than 2%:
- 433.milc slowed down by 4% from 12427 to 12916 perf samples
Below reproducer instructions can be used to re-build both "first_bad" and "last_good" cross-toolchains used in this bisection. Naturally, the scripts will fail when triggerring benchmarking jobs if you don't have access to Linaro TCWG CI.
For your convenience, we have uploaded tarballs with pre-processed source and assembly files at:
- First_bad save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
- Last_good save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
- Baseline save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Configuration:
- Benchmark: SPEC CPU2006
- Toolchain: Clang + Glibc + LLVM Linker
- Version: all components were built from their tip of trunk
- Target: aarch64-linux-gnu
- Compiler flags: -O2 -flto
- Hardware: NVidia TX1 4x Cortex-A57
This benchmarking CI is work-in-progress, and we welcome feedback and suggestions at linaro-toolchain(a)lists.linaro.org . In our improvement plans is to add support for SPEC CPU2017 benchmarks and provide "perf report/annotate" data behind these reports.
THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.
This commit has regressed these CI configurations:
- tcwg_bmk_llvm_tx1/llvm-master-aarch64-spec2k6-O2_LTO
First_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Baseline build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Even more details: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-…
Reproduce builds:
<cut>
mkdir investigate-llvm-bd4c6a476fd037fb07a1c484f75d93ee40713d3d
cd investigate-llvm-bd4c6a476fd037fb07a1c484f75d93ee40713d3d
# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts
# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_tx1-llvm-master-… --fail
chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /llvm/ ./ ./bisect/baseline/
cd llvm
# Reproduce first_bad build
git checkout --detach bd4c6a476fd037fb07a1c484f75d93ee40713d3d
../artifacts/test.sh
# Reproduce last_good build
git checkout --detach 7d4da4e1ab7f79e51db0d5c2a0f5ef1711122dd7
../artifacts/test.sh
cd ..
</cut>
Full commit (up to 1000 lines):
<cut>
commit bd4c6a476fd037fb07a1c484f75d93ee40713d3d
Author: David Blaikie <dblaikie(a)gmail.com>
Date: Mon Nov 29 16:29:25 2021 -0800
Add missing header
---
llvm/lib/Demangle/DLangDemangle.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/lib/Demangle/DLangDemangle.cpp b/llvm/lib/Demangle/DLangDemangle.cpp
index faf91b239490..f380aa90035e 100644
--- a/llvm/lib/Demangle/DLangDemangle.cpp
+++ b/llvm/lib/Demangle/DLangDemangle.cpp
@@ -17,6 +17,7 @@
#include "llvm/Demangle/StringView.h"
#include "llvm/Demangle/Utility.h"
+#include <cctype>
#include <cstring>
#include <limits>
</cut>
VirtIO Initiative ([STR-9])
===========================
- synced up on [AX_XDP task with Akashi-san]
- synced on rust-vmm
[AX_XDP task with Akashi-san]
<https://linaro.atlassian.net/browse/STR-68>
vhost-device maintainer effort ([UM-196])
- started looking at https://github.com/rust-vmm/vhost-device/pull/4
QEMU Upstream Work ([UM-2])
===========================
- posted [PULL for 6.2 0/8] more tcg, plugin, test and build fixes
Message-Id: <20211129171449.4176301-1-alex.bennee(a)linaro.org>
- commented on Re: Follow-up on the CXL discussion at OFTC Message-Id:
<20211119015207.62fhk5mjmvaj5nz4(a)intel.com> to see if I can unblock
- posted [RFC PATCH] blog post: how to get your new feature
up-streamed Message-Id:
<20211126203319.3298089-1-alex.bennee(a)linaro.org>
- posted [PATCH for 6.2?] Revert "vga: don't abort when adding a
duplicate isa-vga device" Message-Id:
<20211202164929.1119036-1-alex.bennee(a)linaro.org>
Upstream MTTCG tests ([QEMU-52])
- posted [kvm-unit-tests PATCH v9 0/9] MTTCG sanity tests for ARM
Message-Id: <20211202115352.951548-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
Other
=====
- wrote [RFC PATCH 0/2] insn plugin tweaks for measuring frequency
Message-Id: <20211203144421.1445232-1-alex.bennee(a)linaro.org>
- might make a good basis for a TCG plugins blog post
Completed Reviews [2/2]
=======================
[PATCH] tests/plugin/syscall.c: fix compiler warnings
Message-Id: <20211128011551.2115468-1-juro.bystricky(a)intel.com>
[PATCH for-6.2? 0/2] arm_gicv3: Fix handling of LPIs in list registers
Message-Id: <20211126163915.1048353-2-peter.maydell(a)linaro.org>
Current Review Queue
====================
TODO [PATCH-4.16 v2] xen/efi: Fix Grub2 boot on arm64
Message-Id: <20211104141206.25153-1-luca.fancellu(a)arm.com>
===============================================================================================================
TODO [PATCH] cpu-models-x86.rst: Tidy up a couple of things
Message-Id: <20211015100718.17828-1-pbonzini(a)redhat.com>
===================================================================================================================
TODO [PATCH 00/16] fdt: Make OF_BOARD a boolean option
Message-Id: <20211013010120.96851-1-sjg(a)chromium.org>
===========================================================================================================
TODO [PATCH v4 00/41] linux-user: Streamline handling of SIGSEGV
Message-Id: <20211006172307.780893-1-richard.henderson(a)linaro.org>
==================================================================================================================================
--
Alex Bennée
Progress:
* UM-2 [QEMU upstream maintainership]
- Code review: worked through some of the backlog and accumulated
a list of series to take once the tree reopens for 7.0
- Wrote and sent some cleanup patches relating to the qemu-common.h
header file
- Fixed a bug where we miscalculated the length for TLB range
invalidations
* QEMU-420 [GICv4 emulation]
- Found the problem with PCI passthrough in my nested test setup:
apparently virtio PCI devices need an extra command line argument
to get them to honour the presence of an IOMMU. Everything is
now working and I've put some notes about the setup into
https://linaro.atlassian.net/browse/QEMU-447
- started to implement the GICv4 redistributor changes
-- PMM
VirtIO Initiative ([STR-9])
===========================
- [this weeks sync], topics on AF_XDP, virtio-video and
virtio-watchdog
[upstream rust-vmm sync meeting]
<https://etherpad.opendev.org/p/rust-vmm-sync-2021&sa=D&source=calendar&ust=…>
QEMU Upstream Work ([UM-2])
===========================
- posted [PATCH for 6.2 v2 0/7] more tcg, plugin, test and build fixes
Message-Id: <20211125154144.2904741-1-alex.bennee(a)linaro.org>
Upstream MTTCG tests ([QEMU-52])
- posted [kvm-unit-tests PATCH v8 00/10] MTTCG sanity tests for ARM
Message-Id: <20211118184650.661575-1-alex.bennee(a)linaro.org>
[mttcg tests to current state and fixed up]
<https://github.com/stsquad/qemu/tree/mttcg/current-tests-v8>
Other
=====
- renewal feedback
Completed Reviews [2/2]
=======================
[PATCH v2 0/3] KVM: qemu patches for few KVM features I developed
Message-Id: <20211101132300.192584-1-mlevitsk(a)redhat.com>
[PATCH v2] hw/intc/arm_gicv3: Update cached state after LPI state changes
Message-Id: <20211124202005.989935-1-peter.maydell(a)linaro.org>
Absences
========
- off 2 days sick
Current Review Queue
====================
TODO [PATCH-4.16 v2] xen/efi: Fix Grub2 boot on arm64
Message-Id: <20211104141206.25153-1-luca.fancellu(a)arm.com>
===============================================================================================================
TODO [PATCH] cpu-models-x86.rst: Tidy up a couple of things
Message-Id: <20211015100718.17828-1-pbonzini(a)redhat.com>
===================================================================================================================
TODO [PATCH 00/16] fdt: Make OF_BOARD a boolean option
Message-Id: <20211013010120.96851-1-sjg(a)chromium.org>
===========================================================================================================
TODO [PATCH v4 00/41] linux-user: Streamline handling of SIGSEGV
Message-Id: <20211006172307.780893-1-richard.henderson(a)linaro.org>
==================================================================================================================================
--
Alex Bennée
Progress:
* QEMU-420 [GICv4 emulation]
- Tracked down and fixed a bug in our ITS emulation which would
(intermittently?) result in a Linux guest reporting "irq 54:
nobody cared" and hanging, because we were not correctly
recalculating the highest priority pending interrupt when the
guest acknowledged a pending LPI. This fix will go into 6.2.
- Set up a test environment for GICv4 work -- because the major
feature of GICv4 is support for directly injecting interrupts
into a VM, the test setup needs to be nested virtualization,
where an outer L1 guest runs on pure emulated QEMU, the inner
L2 guest uses KVM (as provided by L1), and we pass a PCI device
(emulated by QEMU) through from L1 to L2. I think I have this
correctly set up now, but...
- ...the L2 guest hangs because it apparently never sees an
interrupt from the passed-through PCI device. This implies a
bug in our current GICv3 emulation somewhere: need to track
this down before starting in on GICv4 work.
- Separately, I found through code inspection a bug where we
do the wrong thing in the non-passthrough case when the L1 guest
sets a virtual interrupt for the L2 guest in the GIC list
registers and that interrupt has an ID > 1023 (ie it is an LPI).
We got this wrong both for acknowledging and ending an interrupt,
so the two bugs cancel each other out except that we don't set
the vCPU priority and so the L2 guest might get an unexpected
interrupt while it was servicing the LPI. Patches sent.
-- PMM
VirtIO Initiative ([STR-9])
===========================
- posted Initial thoughts for test scenarios for AF_XDP epic
Message-Id: <87k0h5v6ju.fsf(a)linaro.org>
vhost-device maintainer effort ([UM-196])
- more review
- [did some more noodling with rust] to get comfortable with generics
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
[vhost-device crate] <https://github.com/rust-vmm/vhost-device>
[did some more noodling with rust]
<https://gitlab.com/stsquad/softfloat.rs>
QEMU Upstream Work ([UM-2])
===========================
- posted [PULL for 6.2 0/7] misc build and test fixes Message-Id:
<20211116162515.4100231-1-alex.bennee(a)linaro.org>
- posted [RFC PATCH] tests/avocado: fix tcg_plugin mem access count
test Message-Id: <20211117095448.136558-1-alex.bennee(a)linaro.org>
- posted Re: [RFC PATCH] plugins/meson.build: fix linker issue with
weird paths (for v6.2?) Message-Id:
<20211117111924.179776-1-alex.bennee(a)linaro.org>
- posted Re: [PATCH v2 1/3] icount: preserve cflags when custom tb is
about to execute Message-Id: <87h7cbw1tx.fsf(a)linaro.org>
- posted [RFC PATCH] gdbstub: handle a potentially racing TaskState
Message-Id: <20211119145124.942390-1-alex.bennee(a)linaro.org>
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- posted [kvm-unit-tests PATCH v3 0/3] GIC ITS tests Message-Id:
<20211112114734.3058678-1-alex.bennee(a)linaro.org>
- posted [kvm-unit-tests PATCH v8 00/10] MTTCG sanity tests for ARM
Message-Id: <20211118184650.661575-1-alex.bennee(a)linaro.org>
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
[mttcg tests to current state and fixed up]
<https://github.com/stsquad/qemu/tree/mttcg/current-tests-v8>
Completed Reviews [2/2]
=======================
[PATCH v2 0/3] Some watchpoint-related patches
Message-Id: <163662450348.125458.5494710452733592356.stgit@pasha-ThinkPad-X280>
[PATCH 0/5] Update linux-headers + NOIRQ support for KVM gdbstub
Message-Id: <20211111110604.207376-1-pbonzini(a)redhat.com>
Absences
========
- none
Current Review Queue
====================
TODO [PATCH-4.16 v2] xen/efi: Fix Grub2 boot on arm64
Message-Id: <20211104141206.25153-1-luca.fancellu(a)arm.com>
===============================================================================================================
TODO [PATCH] cpu-models-x86.rst: Tidy up a couple of things
Message-Id: <20211015100718.17828-1-pbonzini(a)redhat.com>
===================================================================================================================
TODO [PATCH 00/16] fdt: Make OF_BOARD a boolean option
Message-Id: <20211013010120.96851-1-sjg(a)chromium.org>
===========================================================================================================
TODO [PATCH v4 00/41] linux-user: Streamline handling of SIGSEGV
Message-Id: <20211006172307.780893-1-richard.henderson(a)linaro.org>
==================================================================================================================================
--
Alex Bennée
Progress (short week, 3 days)
* UM-2 [QEMU upstream maintainership]
- Still trying to sort out the regression of booting EL3 guest
code on the imx7 board. I got most of the way through prototyping
a cleanup which would fix this, but then spotted that the
highbank board has a more awkward-to-fix similar problem.
We're going to revert the PSCI emulation change for 6.2 so we
can take the time to get the cleanup right and land it in 7.0.
- Usual patch accumulation, review, etc during release cycle
-- PMM
VirtIO Initiative ([STR-9])
===========================
- project admin
[STR-9] <https://linaro.atlassian.net/browse/STR-9>
[upstream rust-vmm sync meeting]
<https://etherpad.opendev.org/p/rust-vmm-sync-2021&sa=D&source=calendar&ust=…>
[proposal] <https://github.com/rust-vmm/vhost-device/pull/57>
vhost-device maintainer effort ([UM-196])
- did a bunch of review on [vhost-device crate]
[UM-196] <https://linaro.atlassian.net/browse/UM-196>
[vhost-device crate] <https://github.com/rust-vmm/vhost-device>
QEMU Upstream Work ([UM-2])
===========================
[UM-2] <https://linaro.atlassian.net/browse/UM-2>
Upstream MTTCG tests ([QEMU-52])
- posted [kvm-unit-tests PATCH v3 0/3] GIC ITS tests Message-Id:
<20211112114734.3058678-1-alex.bennee(a)linaro.org>
- might as well flush the tree state as I left it
- posted [RFC PATCH] hw/intc: clean-up error reporting for failed
ITS cmd Message-Id:
<20211112170454.3158925-1-alex.bennee(a)linaro.org>
- re-based [mttcg tests to current state and fixed up]
[QEMU-52] <https://linaro.atlassian.net/browse/QEMU-52>
[mttcg tests to current state and fixed up]
<https://github.com/stsquad/qemu/tree/mttcg/current-tests-v8>
Completed Reviews [2/2]
=======================
[PATCH v2 0/3] Some watchpoint-related patches
Message-Id: <163662450348.125458.5494710452733592356.stgit@pasha-ThinkPad-X280>
[PATCH 0/5] Update linux-headers + NOIRQ support for KVM gdbstub
Message-Id: <20211111110604.207376-1-pbonzini(a)redhat.com>
Absences
========
- none
Current Review Queue
====================
TODO [PATCH] cpu-models-x86.rst: Tidy up a couple of things
Message-Id: <20211015100718.17828-1-pbonzini(a)redhat.com>
===================================================================================================================
TODO [PATCH 00/16] fdt: Make OF_BOARD a boolean option
Message-Id: <20211013010120.96851-1-sjg(a)chromium.org>
===========================================================================================================
TODO [PATCH v4 00/41] linux-user: Streamline handling of SIGSEGV
Message-Id: <20211006172307.780893-1-richard.henderson(a)linaro.org>
==================================================================================================================================
TODO [PATCH] softmmu: fix watchpoint processing in icount mode
Message-Id: <163101424137.678744.18360776310711795413.stgit@pasha-ThinkPad-X280>
==============================================================================================================================================
--
Alex Bennée
Progress (short week, 3 days)
* UM-2 [QEMU upstream maintainership]
- recent changes to QEMU's PSCI emulation broke booting of guest code
at EL3 on the imx7 board, which was previously accidentally
relying on PSCI-emulation-via-SMC not getting in its way despite
being enabled. We need to make this board disable PSCI when the
guest code is booting to EL3, as the virt board does, but it's
trickier here because the CPU-creation code is hidden inside a
model of an SoC object. After some on-list discussion I have a
plan for how to restructure this, and need to write some code...
* QEMU-420 [GICv4 emulation]
- re-read the GIC architecture specification, acquired a better
understanding of the required work, and broke this epic down into
stories
- discussed with Leif how the ITS support should be landed in the
sbsa-ref board
Misc:
* higher-than-usual amount of meetings and meeting-prep this week
-- PMM