Commit Graph

1120 Commits

Author SHA1 Message Date
Bart Van Assche
31229b7020 xen: syswrap XEN_SCHEDOP_remote_shutdown
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15383
2015-06-28 16:53:58 +00:00
Bart Van Assche
3adbf40a38 Follow-up for r15381
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15382
2015-06-28 16:52:49 +00:00
Bart Van Assche
d2a0392539 xen: Basic syswrap infrastructure for XEN_sched_op hypercalls
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15381
2015-06-28 16:48:22 +00:00
Bart Van Assche
7a8a964019 xen: syswrap XENMEM_machphys_compat_mfn_list
XENMEM_machphys_compat_mfn_list is functionally identical to
XENMEM_machphys_mfn_list but returns a different list from Xen.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15379
2015-06-28 16:46:30 +00:00
Bart Van Assche
b51ec07994 xen: syswrap XEH_HVMOP_set_pci_intx_level
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15377
2015-06-28 16:44:21 +00:00
Bart Van Assche
56e19e386d xen: syswrap XEN_HVMOP_track_dirty_vram
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15376
2015-06-28 16:43:14 +00:00
Bart Van Assche
04c609b998 xen: implement VKI_XEN_DOMCTL_irq_permission
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15375
2015-06-28 16:42:38 +00:00
Bart Van Assche
278a3d1df5 xen: support for XEN_DOMCTL_iomem_permission
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15374
2015-06-28 16:42:05 +00:00
Bart Van Assche
e93aa3706d xen: Handle XEN_DOMCTL_{test_assign,assign,deassign}_device
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15373
2015-06-28 16:41:06 +00:00
Bart Van Assche
8269099b13 xen: syswrap XEN_DOMCTL_pin_mem_cacheattr
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15371
2015-06-28 16:38:40 +00:00
Bart Van Assche
10d6d0a7ad xen: syswrap XEN_DOMCTL_[gs]et_vcpu_msrs
The XEN_DOMCTL_[gs]et_vcpu_msrs work simiarly to the other get/set pairs,
taking a vcpu, buffer and size.  A query with a buffer of NULL is a request
for the maximum size.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15370
2015-06-28 16:37:54 +00:00
Bart Van Assche
7806d251be xen: syswrap XEN_DOMCTL_[gs]et_ext_vcpustate
The VKI_XEN_DOMCTL_[gs]et_ext_vcpucontext hypercalls have had interface
changes, but are largly just extentions of the existing structure.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15369
2015-06-28 16:36:30 +00:00
Bart Van Assche
b1e2a3e6a1 xen: Add domctl interface version 0x0000000a
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15366
2015-06-28 16:33:04 +00:00
Bart Van Assche
c35715d20a xen: Add support for new sysctl and domctl interface versions
The change causing the sysctl bump is not in an implemented subop yet, so no
change is required.  The change causing the domctl bump is in an implemented
subop, but has also been reverted in favor of a different way of performing
the same actions.  Therefore, there is no net difference.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15365
2015-06-28 16:31:54 +00:00
Christian Borntraeger
c2baee9b7b add KVM_S390_MEMOP ioctl handling
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15334
2015-06-12 10:54:12 +00:00
Julian Seward
eed8fbcd80 Bug 348102 - Patch updating v4l2 API support (edit)
Patch from Hans Verkuil (hverkuil@xs4all.nl) 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15313
2015-06-05 11:23:35 +00:00
Rhys Kidd
11f675de8b Fix unhandled syscall: mach:41 (_kernelrpc_mach_port_guard_trap)
bz#344337

Before:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 14 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15297
2015-05-30 08:59:46 +00:00
Rhys Kidd
9351332329 Signal handler ucontext_t not filled out correctly on OS X
bz#341419

Before:

== 589 tests, 220 stderr failures, 15 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 591 tests, 220 stderr failures, 15 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15296
2015-05-28 12:49:00 +00:00
Florian Krohm
b804dd161f Fix a comment. Do not enumerate segment kinds as all segments
have an extent ... including SkShmC segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15278
2015-05-22 15:14:04 +00:00
Philippe Waroquiers
b09ffd9fb9 Have the hash table 'gen' functions comparing the key instead of the
cmp function.
Document this in the cmp function comment in pub_tool_hashtable.h



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15263
2015-05-20 15:08:09 +00:00
Rhys Kidd
2a3a28aecf Fix unhandled syscall: unix:473 (readlinkat) on OS X 10.10
bz#344936

Before:

== 595 tests, 229 stderr failures, 23 stdout failures, 1 stderrB failure, 1 stdoutB failure, 30 post failures ==

After:

== 595 tests, 228 stderr failures, 23 stdout failures, 1 stderrB failure, 1 stdoutB failure, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15260
2015-05-20 13:31:02 +00:00
Philippe Waroquiers
435d51c1c9 This patch reduces the memory needed for the linesF.
Currently, each SecMap has an array of linesF, referenced by the linesZ
of the secmap that needs a lineF, via an index stored in dict[1].
When the array is full, its size is doubled.
The linesF array of a secmap is freed when the SecMap is GC-ed.
The above strategy has the following consequences:
  A. in average, 25% of the LinesF are unused.
  B. if a SecMap has 'temporarily' a need for linesF, but afterwards,
     these linesF are converted to normal lineZ representation, the linesF
     will not be recuperated unless the SecMap is GC-ed (i.e. fully marked
     no access).

The patch replaces the linesF array private per SecMap
by a pool allocator of LinesF shared between all SecMap.
A lineZ that needs a lineF will directly point to its lineF (using a pointer
stored in dict[1]), instead of having in dict[1] the index in the SecMap
linesF array.
When a lineZ needs a lineF, it is allocated from the pool allocator.
When a lineZ does not need anymore a lineF, it is returned back to the
pool allocator.

On a firefox startup, the above strategy reduces the memory for linesF
by about 42Mb. It seems that the more firefox is used (e.g. to visit
a few websites), the bigger the memory gain.
After opening the home page of valgrind, wikipedia and google, the memory
gain is about 94Mb:
trunk:
  linesF:    392,181 allocd ( 203,934,120 bytes occupied) (   173,279 used)
patch:
  linesF:    212,966 allocd ( 109,038,592 bytes occupied) (   170,252 used)

There is also less alloc/free operations in core arena with the patch:
trunk:
  core    :   810,680,320/  802,291,712 max/curr mmap'd, 17/19 unsplit/split sb unmmap'd,    759,441,224/  703,191,896 max/curr,    40631760/16376828248 totalloc-blocks/bytes,   188015696 searches 8 rzB
patch:
  core    :   701,628,416/  690,753,536 max/curr mmap'd, 12/29 unsplit/split sb unmmap'd,    643,041,944/  577,793,712 max/curr,    32050040/14056017712 totalloc-blocks/bytes,   174097728 searches 8 rzB


In terms of performance, no CPU impact detected on Firefox startup.
Note we have no representative reproducible (and preferrably small)
perf test that uses extensively linesF. Firefox is a good heavy lineF
user but is far to be reproducible, and is very far to be small.

Theoretically, in terms of CPU performance, the patch might have some
small benefits here and there for read operations, as the lineF pointer
is directly retrieved from the lineZ, rather than retrieved via an indirection
in the linesF array.
For write operations, the patch might need a little bit more CPU,
as we replace an
  assignment to lineF inUse boolean to False (and then probably back to True
  when the cacheline is written back)
by 
  a call to pool allocator VG_(freeEltPA) (and then probably a call to
  VG_(allocEltPA) when the cacheline is written back).
These PA functions are small, so cost should be ok.
We might however still maintain in clear_LineF_of_Z the last cleared lineF
and re-use it in alloc_LineF_for_Z. Not sure how many calls to the PA functions
would be avoided by this '1 elt cache' (and the needed 'if elt == NULL'
check in both clear_LineF_of_Z and alloc_LineF_for_Z.
This possible optimisationwill be looked at later.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15253
2015-05-17 19:32:42 +00:00
Florian Krohm
e197c8e00d Changes for tilegx: Use VKI_AT_FDCWD not AT_FDCWD.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15227
2015-05-13 21:26:46 +00:00
Philippe Waroquiers
4256a17920 This patch adds a function that allows to directly properly size an xarray
when the size is known in advance.

3 places identified where this function can be used trivially.

The result is a reduction of 'realloc' operations in core
arena, and a small reduction in ttaux arena
(it is the nr of operations that decreases, the memory usage itself
stays the same (ignoring some 'rounding' effects).

E.g. for perf/bigcode 0, we change from
  core 1085742/ 216745904 totalloc-blocks/bytes,     1085733 searches
  ttaux 5348/   6732560 totalloc-blocks/bytes,        5326 searches
to
  core 712666/ 190998592 totalloc-blocks/bytes,      712657 searches
  ttaux 5319/   6731808 totalloc-blocks/bytes,        5296 searches

For bz2, we switch from
  core 50285/  32383664 totalloc-blocks/bytes,       50256 searches
  ttaux 670/    245160 totalloc-blocks/bytes,         669 searches
to
  core 32564/  29971984 totalloc-blocks/bytes,       32535 searches
  ttaux 605/    243280 totalloc-blocks/bytes,         604 searches

Performance wise, on amd64, this improves memcheck performance
on perf tests by 0.0, 0.1 or 0.2 seconds depending on the test.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15173
2015-05-01 16:46:38 +00:00
Philippe Waroquiers
d6c0fde7fe Move a comment useful to the caller to the .h, rather than keeping it
in the .c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15127
2015-04-21 20:56:49 +00:00
Bart Van Assche
44609129ea Add support for LL_IOC_PATH2FID and LL_IOC_GETPARENT Lustre ioctls
From: Frank Zago <fzago@cray.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15123
2015-04-21 17:46:52 +00:00
Florian Krohm
fd55c4421f Remove SysRes::_valEx from common code as it is specific to mips.
ifdef'ed accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15117
2015-04-20 21:02:18 +00:00
Florian Krohm
a9b8e1e789 Remove function sr_ResHI from Linux specific code.
Add function VG_(sr_as_string).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15116
2015-04-20 20:42:42 +00:00
Zhi-Gang Liu
48fab8613a Add TILEGX arch. specific syscall #245, __NR_cacheflush
By:Zhi-Gang Liu


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15096
2015-04-15 03:22:17 +00:00
Philippe Waroquiers
da3a839f90 Remove useless arguments in sparsewa, that were inheritated from WordFM
These arguments are not needed for sparsewa, as they can only
return the key given in input.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15083
2015-04-11 11:42:22 +00:00
Julian Seward
082f9298a1 Add a port to Linux/TileGx. Zhi-Gang Liu (zliu@tilera.com)
Valgrind aspects, to match vex r3124.

See bug 339778 - Linux/TileGx platform support to Valgrind



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15080
2015-04-10 12:30:09 +00:00
Florian Krohm
e70d5a57f1 The linux launcher showed some odd behaviour. When given a shell script
named 'now' with this contents:

#!
/bin/date

the platform selection logic does this:

--11196:1:launcher no tool requested, defaulting to 'memcheck'
--11196:2:launcher   selecting platform for './now'
--11196:2:launcher   selecting platform for './now'
--11196:2:launcher   opened './now'
--11196:2:launcher   read 13 bytes from './now'
--11196:2:launcher   selecting platform for ''
--11196:2:launcher   selecting platform for '/home/florian/bin/'
--11196:2:launcher   opened '/home/florian/bin/'
--11196:2:launcher   selected platform 'unknown'
--11196:1:launcher no platform detected, defaulting platform to 'amd64-linux'

That is not quite right. Instead the platform should be determined by
examining the default shell.
Additionally, define VKI_BINPRM_BUF_SIZE because on linux only that many
characters are considered on a #! line. C.f. <linux>/fs/binfmt_script.c
m_ume/* needs to be adapted as well but that is a different patch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15068
2015-04-06 14:29:45 +00:00
Florian Krohm
87a05e65b1 Tweak STATIC_ASSERT such that there is no warning about an unused
variable when used at block scope.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15066
2015-04-04 18:43:00 +00:00
Florian Krohm
17913a5d5d Fix function sr_EQ which compares two SysRes values. On Linux it was
forgotten to compare SysRes::_valEx.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15060
2015-04-01 19:20:16 +00:00
Rhys Kidd
537b3dfeeb Fix Darwin: -v does not show kernel version
bz#201435

Before:

== 590 tests, 237 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

After:

== 590 tests, 237 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15056
2015-04-01 12:15:49 +00:00
Florian Krohm
f39011b8b6 Add STATIC_ASSERT and use it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15047
2015-03-28 18:36:01 +00:00
Florian Krohm
2055aa80cf Simplify expression.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15035
2015-03-23 20:04:14 +00:00
Julian Seward
37f7ddaea7 PRE(sys_prctl): handle PR_SET_SECCOMP.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14994
2015-03-10 11:05:10 +00:00
Florian Krohm
ec19425185 Include pub_core_aspacemgr.h only where needed.
Also fixes BZ #344235.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14966
2015-02-26 17:48:07 +00:00
Mark Wielaard
5fa9a30cea Bug #344318 socketcall should wrap recvmmsg and sendmmsg
Some architectures, e.g. s390, don't have dedicated recvmmsg and sendmmsg
system calls, but use the socketcall multiplexing system call with
SYS_RECVMMSG or SYS_SENDMMSG (just like the accept4 systemcall can also
be called through socketcall). Create separate helpers for recvmmsg and
sendmmsg helpers that can be used by either the direct syscall or the
socket call.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14964
2015-02-25 14:00:14 +00:00
Rhys Kidd
f3c4b1a67a Fix OS X 10.10 (Yosemite) - missing system calls and fcntl code, courtesy of Bill Zissimopoulos
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14951
2015-02-21 12:24:18 +00:00
Florian Krohm
00ffec50e5 Pass in a mask of segment kinds to VG_(get_segment_starts)
and VG_(am_get_segment_starts) to indicate which segments
should be collected. That should solve the following problem:
in m_main.c we used to:

      seg_starts = VG_(get_segment_starts)( &n_seg_starts );

      for (i = 0; i < n_seg_starts; i++) {
         Word j, n;
         NSegment const* seg 
            = VG_(am_find_nsegment)( seg_starts[i] );
         vg_assert(seg);
         if (seg->kind == SkFileC || seg->kind == SkAnonC) {

         ...
         // ... dynamic memory allocation for valgrind
         ...
      }

This caused the vassert(seg) to fire because the dynamic memory
allocation further down the loop changed segments such that a 
valgrind segment which used to be non-SkFree suddenly became 
SkFree and hence VG_(am_find_nsegment) returned NULL. Whoom.

With this revision we only collect the segments we're really
interested in. For the example above that is all client segments.
So if V allocates memory -- fine. That will not change the layout
of client segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14949
2015-02-20 14:00:23 +00:00
Julian Seward
199646a9cd Correctly handle prctl(VKI_PR_SET_PTRACER, ..) so as to avoid false
positives (eg when running Wine).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14946
2015-02-18 15:46:19 +00:00
Florian Krohm
798e5a7707 Translations are allowed from all client segments. Update comments
and rename VG_(am_set_segment_hasT_if_SkFileC_or_SkAnonC) to 
VG_(am_set_segment_hasT_if_client_segment). Change it so it handles
all client segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14936
2015-02-16 22:58:30 +00:00
Florian Krohm
7f6f4f0a01 Update a few comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14935
2015-02-16 22:29:03 +00:00
Florian Krohm
d47181fd7d Add command line flag --max-threads=<integer> to increase the number of
threads that valgrind can handle. No recompile is needed. 
Part of fixing BZ #337869.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14932
2015-02-13 19:08:26 +00:00
Julian Seward
b4287f205a arm32-linux: for the magic-call CALL_FN_* macros, add r12 to the asm
trash list.  Not doing so was causing r12 to get corrupted by the
called function, which lead to some very strange failures in Helgrind
on arm32.  Fixes #344033.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14929
2015-02-11 19:46:27 +00:00
Julian Seward
43d073531e Update to track v4l2 API for kernel version 3.19 changes. Patch from
Hans Verkuil (hverkuil@xs4all.nl).  Fixes #343069.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14909
2015-02-05 15:59:01 +00:00
Julian Seward
fc8c7cbd98 Add wrapper support for I2C_SMBUS ioctls. Patch from
super.firetwister@gmail.com.  Fixes #342603.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14908
2015-02-05 15:52:46 +00:00
Julian Seward
45a0fb5e69 Allow the user to specify precise-exception behaviour for translations
made from file-backed mappings (AOT code, basically) that is different
from the default behaviour as specified by --vex-iropt-register-updates.

New flag is --px-file-backed=, with the same possible args as
--vex-iropt-register-updates has.

Add a new flag --px-default, which is a short alias for
--vex-iropt-register-updates.

Add one line of stats output when --stats=yes, showing counts of how
many translations have been made under each of the 4 different PX
optimisation settings.

No user-visible change if you don't use the new flags.

Relies on VEX API change in r3084.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14906
2015-02-05 12:59:46 +00:00