Commit Graph

294819 Commits

Author SHA1 Message Date
riastradh d74951364b drm: Use ACPI_FREE, not kfree, for ACPI_ALLOCATE_BUFFER result.
Most of this code is not currently enabled, but it might be enabled
soon.
2022-02-27 14:24:26 +00:00
riastradh 1b1d530c73 vmem(9): Assert addresses are quantum-aligned. 2022-02-27 14:24:11 +00:00
riastradh e4a2ed4f90 amdgpu: Make amdgpu_bios.c ACPI stuff build. 2022-02-27 14:23:24 +00:00
riastradh 742aa562a4 radeon: Make radeon_bios.c ACPI stuff build. 2022-02-27 14:23:16 +00:00
riastradh 833d5b2e00 linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu. 2022-02-27 14:23:08 +00:00
riastradh b2dc201f43 linux: Define acpi_size as alias for ACPI_SIZE. 2022-02-27 14:22:50 +00:00
riastradh 7282f92ed4 drm: Move Linux ACPI case aliases to new nbsd-namespace-acpi.h. 2022-02-27 14:22:42 +00:00
riastradh 9996ea54bf drm: Omit needless conditionals around #include "acpica.h". 2022-02-27 14:22:29 +00:00
riastradh c981a8797d drm: Move acpi_check_dsm &c. from intel_acpi.c to new linux_acpi.c. 2022-02-27 14:22:21 +00:00
riastradh 19ebad9e18 i915: Omit needless ifdefs around ACPI API. 2022-02-27 14:20:30 +00:00
riastradh b07b58a53d i915: Use pci_get_segment, not 0. 2022-02-27 14:19:35 +00:00
riastradh 96633a0d67 drm: Deconditionalize pci_get_segment. 2022-02-27 14:19:20 +00:00
riastradh 402ed3092e acpi: Nix conditional pci_get_segment use.
New MI default of 0 serves.
2022-02-27 14:19:07 +00:00
riastradh 6124f7e542 pci(9): Provide default definition of pci_get_segment, always zero.
pci_machdep.h can define __HAVE_PCI_GET_SEGMENT to provide a nonzero
definition.
2022-02-27 14:18:52 +00:00
riastradh 7f7ad94cf7 i915: Use new rb_move to relocate the active tree. 2022-02-27 14:18:42 +00:00
riastradh d18f7e9f4e linux: New rb_move(&to, &from) to replace `to = from'.
NetBSD rbtree(3) is not relocatable, so this extra step is needed.
Unfortunately, there's no easy way to automate detection of where we
need to apply this in ported code...
2022-02-27 14:18:34 +00:00
riastradh 43c61abaa1 linux: Actually do post-order tree traversal.
Requires breaking the rbtree(3) abstraction, but this is necessary
because the body of the loop often frees the element, so as is we had
a huge pile of use-after-free going on.

Requires changing struct interval_tree_node's rbnode member to match
the Linux name, since we now use container_of here, and radeon relies
on this.
2022-02-27 14:18:25 +00:00
riastradh dbcf7f26b9 alpha: Fix placement of membar for sending ICCB message.
While here, reduce it to membar_exit -- it's obviously not needed for
store-before-load here (although alpha doesn't have anything weaker
than the full sequential consistency `mb'), and although we do need a
store-before-load (and load-before-load) to spin waiting for the CPU
to wake up, that already happens a few lines below with alpha_mb in
the loop anyway.  So no need for membar_sync, which is just `mb'
under the hood -- deleting the membar_sync in this place can't hurt.

The membar_sync had been inserted automatically when converting from
an older style of atomic_ops(3) API.
2022-02-27 14:17:10 +00:00
riastradh 22efbccd39 pool(9): Membar audit.
- Use atomic_store_release and atomic_load_consume for associating a
  freshly constructed pool_cache with its underlying pool.  The pool
  gets published in various ways before the pool cache is fully
  constructed.

  => Nix membar_sync -- no store-before-load is needed here.

- Take pool_head_lock around sysctl kern.pool TAILQ_FOREACH.  Then take
  a reference count, and drop the lock, around copyout.

  => Otherwise, pools could be partially initialized or freed while
     we're still trying to read from them -- and in the worst case,
     we might see a corrupted view of the tailq.

  => If we kept the lock around copyout, this could deadlock in memory
     allocation.

  => If we didn't take a reference count while releasing the lock, the
     pool could be destroyed while we're trying to traverse the list,
     sending us into oblivion instead of the next element.
2022-02-27 14:16:43 +00:00
riastradh e468962b6a lockstat(4): KNF. No functional change intended. 2022-02-27 14:16:32 +00:00
riastradh d3ab1269bf lockstat(4): Membar audit.
- Serialize updates to lockstat_enabled, lockstat_dev_enabled, and
  lockstat_dtrace_enabled with a new __cpu_simple_lock.

- Use xc_barrier to obviate any need for additional membars in
  lockstat_event.

- Use atomic_load/store_* for access that might not be serialized by
  lockstat_lock or lockstat_enabled_lock.
2022-02-27 14:16:12 +00:00
martin 5aadf4103d Do not assume we have a SYS_getrandom for the tools build. 2022-02-27 12:27:22 +00:00
rillig a5dc812cd9 tests/lint: add tests for messages referring to C99 2022-02-27 12:00:27 +00:00
riastradh 466d95cdbd evbppc/temac(4): Mark unused functions as such. 2022-02-27 11:49:28 +00:00
rillig 0a781eec83 lint: C99 has been released, so refer to it by its proper name 2022-02-27 11:40:29 +00:00
rillig 90900cebb7 lint: unabbreviate two more members of sym_t
No functional change.
2022-02-27 11:14:42 +00:00
rillig 8e7e0d4a25 lint: remove unused enumeration details from symbol type
No functional change.
2022-02-27 10:49:15 +00:00
rillig 608bf41933 lint: unabbreviate some fields in sym_t
No functional change.
2022-02-27 10:44:45 +00:00
rillig 6bd0b7583f lint: encode lifetime of allocated memory in function names
No functional change.
2022-02-27 10:31:58 +00:00
rillig fa4dd0e745 lint: encode lifetime of allocated memory in the function names
No functional change.
2022-02-27 08:31:26 +00:00
rillig baa5e17b5f lint: clean up memory management for string buffers
There is no reason to duplicate all the work that is already done by the
memory allocator.

No functional change.
2022-02-27 07:50:09 +00:00
rillig ae25203d65 lint: clean up memory allocation
No functional change.
2022-02-27 07:38:54 +00:00
rillig 1de34d13b5 lint: remove custom free list for memory blocks
Trust the system memory allocator to do its thing, including marking the
memory as fresh or freed.  One less thing to worry about.
2022-02-27 06:55:13 +00:00
rillig 6c3c49443e lint: rename ARG to OLD_STYLE_ARG
Pre-C90 argument declarations have been old for more than 30 years now,
so mention that fact in the constant name.  This reduces potential
confusion with other occurrences of the words 'arg' or 'argument'.

No functional change.
2022-02-27 01:47:28 +00:00
gutteridge e96b8d4c40 lwp.h: correct grammar in a comment 2022-02-27 01:03:14 +00:00
rillig 0220fee323 lint: improve debug logging for symbol kinds 2022-02-26 23:07:28 +00:00
rillig 1887ef10af lint: fix memory corruption in statement expressions (since 2021-12-17)
The commit that introduced the assertion failure looks innocent, it only
adds a few predefined functions for GCC mode.  Nevertheless, before that
commit, lint consistently complained about 'error: void type illegal in
expression [109]', which doesn't make sense either.

This fix also removes the creative use of the initialization stack to
store the type of the statement expression.  Having a separate stack for
these statement expressions makes the code easier to understand.
2022-02-26 20:36:11 +00:00
rillig 785a291ff6 lint: extract code for handling statement expressions from the grammar
This prepares the fix of the memory corruption bug that is demonstrated
in t_integration.sh, test case assertion_failures.

No functional change.
2022-02-26 19:01:09 +00:00
christos 8cb2545f45 don't require arc4random_buf for tools build 2022-02-26 18:49:42 +00:00
rillig 5454c52f6f lint: enable memory debugging
Filling deallocated memory with 0x00 may hide errors, so rather fill
with 0xA5.

While this doesn't change anything about the test about the assertion
failure after a do-while loop (see t_integration.sh, test case
assertion_failures), it may detect other similar bugs earlier.
2022-02-26 18:35:01 +00:00
christos fe40cc2899 explain CRON_WITHIN better. 2022-02-26 17:02:47 +00:00
rillig 292c0f5964 tests/lint: demonstrate assertion failure in GCC compound expression 2022-02-26 16:43:20 +00:00
gson cfc4b6e400 Mark randomly failing test cases as expected failures with a reference
to PR bin/56506.
2022-02-26 16:21:59 +00:00
rillig ca55d6940d drm2: do not try to return a value from a void function
lint complained:
vmalloc.h(79): error: void function vfree cannot return value [213]

No functional change.
2022-02-26 15:57:22 +00:00
christos e60236d7f0 re-enable getrandom for the non-tools build (thanks martin) 2022-02-26 15:40:09 +00:00
rillig 47b841df3a if_wm.c: fix value return from void function
lint complained:
if_wm.c(10028): error:
    void function wm_txrxintr_disable cannot return value [213]
if_wm.c(10049): error:
    void function wm_txrxintr_enable cannot return value [213]

No functional change.
2022-02-26 15:04:39 +00:00
rillig 7ac7a1f366 if_wm.c: remove stray semicolons from struct declaration
C99 does not allow 'struct { int member;; }'.

No binary change.
2022-02-26 14:53:05 +00:00
christos aaa76c6b02 fix merge botch and reduce diff from upstream. 2022-02-26 13:30:19 +00:00
christos c7718d483a ah, wiz added another endif. 2022-02-26 13:17:39 +00:00
christos a6b78e7572 remove stray #if 0 2022-02-26 13:15:18 +00:00