Commit Graph

273669 Commits

Author SHA1 Message Date
thorpej
a2249e70e6 - Add an ifmedia_fini() routine, to free resources assocated with
an ifmedia.  Currently calls ifmedia_removeall().  All drivers
  that call ifmedia_init() and support detach should call this
  routine.
- In ifmedia_delete_instance(), set ifm->ifm_cur to NULL and
  ifm->ifm_media to IFM_NONE when removing / freeing that entry,
  not simply when we've been asked to delete every media instance.
2020-02-01 20:56:16 +00:00
tnn
8fd56fc1ed fix build 2020-02-01 20:11:24 +00:00
tsutsui
fc9073f9fe Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).
Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
  but each port uses different PAGE_SIZE value (4096 or 8192)
  due to historical reasons.
- Currently module(7) binaries are built per each port so
  all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
  PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
  are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
  src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
  for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
  among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
  support m68k ports where PAGE_SIZE==8192.
  (though this would affect only if static binaries built on
   4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
 https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
 https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
2020-02-01 19:41:48 +00:00
christos
8d8bf0f068 fix incorrect type 2020-02-01 19:29:27 +00:00
christos
d26e043876 use designated initializers 2020-02-01 19:11:59 +00:00
jmcneill
7058d749ef appease -Werror=missing-field-initializers 2020-02-01 18:24:24 +00:00
kamil
31ebab1943 Revert previous
'git grep' breaks now.
2020-02-01 18:14:16 +00:00
kamil
f93ad70739 Remove 'ifdef 0' hacks
It is no longer needed as the proper fix avoiding premature malloc()
landed the sources.
2020-02-01 15:39:56 +00:00
kamil
089c97bd22 Switch atform allocations from malloc()+free() to mmap()+munmap()
This avoid bootstrapping malloc too early when libc+libpthread are not
ready. It is called through pthread__init() -> _pthread_atfork().

This also helps LLVM Leak Sanitizer to pacify false positive reports.
2020-02-01 15:38:46 +00:00
jmcneill
df2a83facc Use kmem_zalloc for its state, fixes possible crash if a driver tries to
set affinity before a CPU is online.
2020-02-01 15:33:48 +00:00
skrll
4481a897c2 Use designated initializers 2020-02-01 15:24:04 +00:00
riastradh
f3ecae1cb1 opencrypto orders new_session -> process for us.
No need for membar_producer.

Discussed with hikaru@.
2020-02-01 13:48:18 +00:00
riastradh
26cde978c1 softint_disestablish does xc_barrier(0) for us already. 2020-02-01 13:48:08 +00:00
jmcneill
8507cd68b3 Add NXP/Freescale ESDHC specific support 2020-02-01 13:40:55 +00:00
riastradh
7735b624a8 Redocument xc_barrier.
Be more clearer, and more correcter, about what it does.
2020-02-01 13:35:11 +00:00
jmcneill
1583ac800f Add support for NXP Layerscape PCIe Gen4 (not ECAM compliant) 2020-02-01 13:26:43 +00:00
jmcneill
996c868a1d Use acpi_match_hid to match both _HID and _CID 2020-02-01 13:09:08 +00:00
riastradh
60846ea357 KNF 2020-02-01 12:55:35 +00:00
riastradh
0e65a47eba Reduce some ifdefs. 2020-02-01 12:55:26 +00:00
thorpej
6a41b9f75c Adopt <net/if_stats.h>.
XXX This driver needs some work in this regard (practually no
stats are reported).
2020-02-01 12:55:22 +00:00
riastradh
868a36fd22 pic_pending_zero is unnecessary; percpu_alloc already zeroes. 2020-02-01 12:55:13 +00:00
riastradh
7d3a3e76f6 Switch arm pic allocation and initialization to percpu_create. 2020-02-01 12:55:02 +00:00
riastradh
4734f65cda Switch sys/net to percpu_create. 2020-02-01 12:54:50 +00:00
riastradh
3d6eb80076 Switch opencrypto to percpu_create.
Can't sleep for allocation in percpu_foreach.
2020-02-01 12:54:30 +00:00
riastradh
4bf5723bb1 KNF 2020-02-01 12:53:41 +00:00
riastradh
1cae704d79 Use __read_mostly and gather related __cacheline_aligned together.
Should save a few bytes of kernel.
2020-02-01 12:51:18 +00:00
riastradh
d92a26fbe9 New function percpu_create.
Associates a constructor and destructor with the percpu.  Currently
the constructor runs immediately, but in principle we could use the
same API for future CPU hotplug support.

This lets you sleep for allocation or draining users before
deallocation when setting up or tearing down a percpu -- currently we
have many abuses of percpu_foreach in tree for that purpose.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2020/01/30/msg026036.html
2020-02-01 12:49:02 +00:00
thorpej
3451334835 Adopt <net/if_stats.h>. 2020-02-01 12:45:05 +00:00
skrll
2b4becba62 G/C 2020-02-01 09:21:49 +00:00
isaki
c0c8907c33 Make it output 68000 binary.
CFLAGS already has -m68000 but AFLAGS didn't.

This change makes it proceed to next stage1 even if MPU is 68000.
All stage1 bootloader displays an error message if MPU is 68000.
2020-02-01 08:08:15 +00:00
thorpej
b3ed1ce596 Adopt <net/if_stats.h>. 2020-02-01 07:12:40 +00:00
thorpej
ad1b1128be Adopt <net/if_stats.h>. 2020-02-01 06:38:58 +00:00
thorpej
77438b1eb3 Adopt <net/if_stats.h>. 2020-02-01 06:17:23 +00:00
tsutsui
721e2dfed8 Use "__nothing" macro defined in <sys/cdefs.h> for empty pmap_update().
Suggested by pgoyette@ in PR/54869.
2020-02-01 06:17:11 +00:00
tsutsui
c8cea24eea Add and enable dhcpcd for news68k installation.
news68k has already required two floppies since 9.0
so there is no popular demand to shrink ramdisk.
2020-02-01 06:02:00 +00:00
thorpej
4683cc0316 Adopt <net/if_stats.h>. 2020-02-01 05:14:28 +00:00
riastradh
a59e7725a3 Switch if_vlan to atomic_load/store_*.
Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
vlan_lookup_tag_psref.
2020-02-01 02:58:15 +00:00
riastradh
24f30c4a12 Switch if_l2tp to atomic_load/store_*.
Fix missing membar_datadep_consumer -- now atomic_load_consume -- in
l2tp_lookup_session_ref.
2020-02-01 02:58:05 +00:00
riastradh
47880c1380 Fix order in rollback case; switch if_ipsec to atomic_load/store_*. 2020-02-01 02:57:55 +00:00
riastradh
ffb7faba0e Switch if_gif to atomic_load/store_*. 2020-02-01 02:57:45 +00:00
riastradh
1e135441b0 Fix wrong memory order and switch pfil to atomic_load/store_*. 2020-02-01 02:54:31 +00:00
riastradh
c776a021f6 Fix wrong memory order and switch bpf to atomic_load/store_*. 2020-02-01 02:54:02 +00:00
riastradh
59523fb8d0 Use atomic_load_acquire for FreeBSDish atomic_load_acq_uint shim. 2020-02-01 02:33:08 +00:00
riastradh
e8a2aeafd9 Use atomic_load/store_* in ena(4), not questionable membar_sync. 2020-02-01 02:32:40 +00:00
riastradh
17201b1c03 Load struct fdfile::ff_file with atomic_load_consume.
Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper.  And a little clearer without a long comment.)
2020-02-01 02:23:23 +00:00
riastradh
8e6cd4ce57 Load struct filedesc::fd_dt with atomic_load_consume.
Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
  => This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
  => atomic_load_consume serves the same purpose now.
  => Was needed only on alpha anyway.
2020-02-01 02:23:03 +00:00
jmcneill
340b7c4ae7 Match HID 808622B7 (DesignWare USB3) 2020-01-31 23:12:13 +00:00
thorpej
be29826f37 Adopt <net/if_stats.h>. 2020-01-31 22:41:07 +00:00
jmcneill
71b3ef8c01 Bump MESA_LLVM_VERSION_STRING 2020-01-31 21:13:40 +00:00
jmcneill
af36371a98 Change HAVE_LLVM from 0x0700 to 0x0900. 2020-01-31 20:58:18 +00:00