Commit Graph

261820 Commits

Author SHA1 Message Date
riastradh ac306aa704 Sort. 2018-08-27 15:11:04 +00:00
riastradh 88b7f7da4f Fix argument types of atomic64_add/sub to be sensible.
Technically Linux does use long long rather than int64_t, but that's
silly.
2018-08-27 15:10:52 +00:00
riastradh 101f4868d0 Implement ATOMIC64_INIT. 2018-08-27 15:10:41 +00:00
riastradh e733144d22 Need <uvm/uvm.h> for struct uvm_object. 2018-08-27 15:10:25 +00:00
riastradh 8def7a33b3 Sprinkle AGP conditionals where needed. 2018-08-27 15:10:12 +00:00
riastradh 290bbba29a Work around a namespacing clash between dtrace and linux symbol. 2018-08-27 15:09:58 +00:00
riastradh 11e2f4e40e Use dtrace probes to implement i915_trace.h. 2018-08-27 15:09:35 +00:00
riastradh 1d9ce7071c Hash-locked atomic64 to give ports like powerpc32 a chance at radeon. 2018-08-27 15:08:54 +00:00
riastradh fdce7bed9d Delete spurious file accidentally committed. 2018-08-27 15:08:25 +00:00
riastradh 936018793f dtrace sdt probes for linux rcu. 2018-08-27 15:07:59 +00:00
riastradh 70435d9314 Don't skimp on the last batch of work when worker is dying.
This is capitalism.  We can't afford to waste time the worker could
spend on labour even if we work 'em to death!
2018-08-27 15:07:44 +00:00
riastradh 077afc9a15 Work around broken empty expansion of SDT_PROBE* if !KDTRACE_HOOKS. 2018-08-27 15:07:29 +00:00
riastradh e794a29ba6 sdt dtrace probes for linux kmap. 2018-08-27 15:07:11 +00:00
riastradh 5248a24ccc sdt dtrace probes for linux idr. 2018-08-27 15:06:54 +00:00
riastradh ccfee5f718 Sprinkle dtrace probes all over the Linux workqueue stuff. 2018-08-27 15:06:37 +00:00
riastradh 0466378a17 Fix post-cancellation case of queue_delayed_work.
Request the callout queue immediately, as if it hadn't been cancelled
at all, rather than reschedule for the next tick.
2018-08-27 15:06:20 +00:00
riastradh e27b343568 Rework Linux workqueue synchronization yet again.
- Use a low bit in the pointer to the queue, rather than whether the
  pointer is null or not, to determine whether the work item is
  queued/scheduled.

- _Preserve_ the pointer to the queue after we release the work.

- Release the work _before_ executing the function, not after.

This simplifies some things: we no longer have to distinguish whether
the work is queued or running in the functions where we are trying to
modify it.  The pointer has to be preserved even after the work is
released so that we can flush the workqueue after the work has been
released.
2018-08-27 15:06:02 +00:00
riastradh a1c732f301 Fix flush_delayed_work semantics: run it now if it was scheduled. 2018-08-27 15:05:44 +00:00
riastradh 168b5894a5 Reorder fields to get better space savings than bit fields. 2018-08-27 15:05:30 +00:00
riastradh 31bca41163 Document workqueue semantics as I understand it. 2018-08-27 15:05:16 +00:00
riastradh 1fca7189a5 Avoid the prospect of callout calls piling up.
Don't ever callout_schedule the callout while an existing call may be
in progress.

Echo some cases from cancel_delayed_work in flush_delayed_work.
2018-08-27 15:05:01 +00:00
riastradh 296411f744 Don't let more than one thread claim credit for cancellation. 2018-08-27 15:04:45 +00:00
riastradh 50219d6a99 Factor out waiting for current work. 2018-08-27 15:04:32 +00:00
riastradh 6bba4bb671 Merge two similar branches. 2018-08-27 15:04:19 +00:00
riastradh d2984e1fab Deduplicate callout destruction. 2018-08-27 15:03:59 +00:00
riastradh 450ff8bbdc Deduplicate callout initialization. 2018-08-27 15:03:45 +00:00
riastradh a1f195dae7 Handle a bazillion additional cases I hadn't considered.
There's a lot of duplication here.  To be deduplicated in a
subsequent commit.
2018-08-27 15:03:32 +00:00
riastradh 6810725695 Fix semantics of flush_work and flush_delayed_work.
- Change return type to void.
  => Upstream it is bool, but exactly one of hundreds of callers
     actually use it, and I don't think the semantics is clear.

- Make sure to wait for whichever of the current work _and_ the next
  batch queued is currently there in the workqueue.

- Don't retry a cancelled callout.  Cancellation in the state
  DELAYED_WORK_CANCELLED is guaranteed.
2018-08-27 15:03:20 +00:00
riastradh 9cb8c351bd Reverse the sense of some branches for simplicity. 2018-08-27 15:03:07 +00:00
riastradh 5f1b90f39a Fix bugs in workqueue destruction. 2018-08-27 15:02:52 +00:00
riastradh 7a09cf8a76 Fully initialize workqueue struct. Zalloc for paranoia. 2018-08-27 15:02:38 +00:00
riastradh 551d54d11f No need to retry in cancel_delayed_work_sync after all. 2018-08-27 15:02:19 +00:00
riastradh 535de6e400 Deduplicate post-cancellation logic. 2018-08-27 15:02:08 +00:00
riastradh 5891db5c6e Don't touch a work after it is released. 2018-08-27 15:01:47 +00:00
riastradh 01334e6900 Non-waiting cancellation may need to release work too. 2018-08-27 15:01:13 +00:00
riastradh 61b3d58635 After cancel and callout_halt, may need to reload workqueue. 2018-08-27 15:00:57 +00:00
riastradh 5638bd9cfa Don't wait forever to flush if the worker thread has no work. 2018-08-27 15:00:27 +00:00
riastradh 6c0c863ee4 Sprinkle some assertions. 2018-08-27 14:59:58 +00:00
riastradh 7d2f7a0702 Exercise greater care in acquiring and releasing work. 2018-08-27 14:59:20 +00:00
rin 2e56c8b44a Check ifp->if_capenable, not ifp->if_capabilities, when enable some features.
Not a real problem since ifp->if_capabilities = 0 at the moment.
2018-08-27 14:59:04 +00:00
riastradh b8dd8a9b3f Add missing break. 2018-08-27 14:58:57 +00:00
riastradh ddd95367de Add missing namespace for flush_scheduled_work. 2018-08-27 14:58:40 +00:00
riastradh dd8f93d733 Add KASSERT about state after callout fires. 2018-08-27 14:58:24 +00:00
riastradh ac596c7fca Work is not necessarily queued in flush_work either.
Regularize style: use initializer only if the wq is guaranteed, and
confirmed by KASSERT, to be set
2018-08-27 14:58:09 +00:00
riastradh 43c369bcf4 Work is not necessarily queued in cancel_work. 2018-08-27 14:57:55 +00:00
riastradh 9ee469e1db Draft rewrite of Linux workqueue reimplementation.
Just use an explicit thread; don't attempt to fudge it with
workqueue(9).  No doubt there are various mistakes in here, but they
should be easier to get right than the mega-kludgerific nonsense that
preceded this draft.
2018-08-27 14:57:21 +00:00
sevan ae1f9ce6c8 Add missing -z flag to usage() 2018-08-27 14:55:46 +00:00
riastradh f3083eb260 Mark some NetBSDisms as such. 2018-08-27 14:54:32 +00:00
riastradh 45e24dc2e9 Read from the data register, not the index we just wrote. 2018-08-27 14:54:08 +00:00
riastradh 126550ec16 Scale offset by size of unit, gen6_pte_t. 2018-08-27 14:53:54 +00:00