Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[op/gsoc2014/smap+kpatch] separate MI / MD part of KSP #1

Closed
opntr opened this issue Aug 8, 2014 · 1 comment
Closed

[op/gsoc2014/smap+kpatch] separate MI / MD part of KSP #1

opntr opened this issue Aug 8, 2014 · 1 comment
Assignees

Comments

@opntr
Copy link
Owner

opntr commented Aug 8, 2014

No description provided.

@opntr opntr self-assigned this Aug 8, 2014
@opntr
Copy link
Owner Author

opntr commented Aug 9, 2014

patch: f725aa7

@opntr opntr closed this as completed Aug 9, 2014
opntr pushed a commit that referenced this issue Nov 1, 2014
Add new functions to manipulate these mode & state, instead of calling
kbdd_ioctl() everyhere.

This fixes at least two bugs:

    1. The state of the Scroll Lock LED and the state of scroll mode
       could be out-of-sync. For instance, if one enables scroll mode on
       window #1 and switches to window #2, the LED would remain on, but
       the window wouldn't be in scroll mode.

       Similarily, when switching between a console and an X.Org
       session, the LED states could be inconsistent with the real
       state.

    2. When exiting from an X.Org session, the user could be unable to
       type anything. The workaround was to switch to another console
       window and come back.

Differential Revision:	https://reviews.freebsd.org/D821
Reviewed by:	ray@
Approved by:	ray@
Tested by:	kwm@
MFC after:	3 days
opntr pushed a commit that referenced this issue May 21, 2015
…s connected) to ACPI C2.

ACPI C3 ends up doing a lot more work before entering sleep, some of which
requires grabbing a global ACPI hardware serialising mutex.

Because of this, the more CPU cores you have, the more that lock contends
under load, reaching close to the #1 lock contention (after VM, which is being
worked on.)

Tested:

* Sandy bridge Xeon, 2 socket * 8 core
* Ivy bridge Xeon v2, 2 socket * 8 core
* Westmere-EX, 4 socket * 10 core
* Ivybridge desktop
* Sandybridge mobile
* Ivybridge mobile

MFC after:	2 weeks
opntr pushed a commit that referenced this issue Jun 20, 2015
The iwn(4) firmware forgets most of its channel state after an RXON
command.  This means that any beacons its seen on passive 5GHz channels
are forgotten upon an association/authorisation request.
This unfortuantely means that 5GHz association almost always fails -
the assoc and/or auth frames are dropped with a status of "passive
channel, haven't seen a beacon yet." (0x90.)

So:

* add an xmit queue, global, to buffer frames
* modify the xmit path to use the mbuf tag from net80211
  to specify raw frame details
* buffer xmit frames from both raw and non-raw paths
* if a beacon is seen in the RX path, schedule a taskqueue to
  send said frames and un-buffer things.
* flush frames during state change back to INIT, or NIC
  down/up/detach.

This isn't the final shape I'd like this to be in but it certainly
is better than 5GHz "not working at all".

Tested:

* Intel 5100, STA mode (before spilling coffee)
* Intel 5300, STA mode (after spilling coffee)

Story:

* This has been bugging me at work for months, which I just
  worked around by throwing an ath(4) into my Lenovo T400 cardbus
  slot.

* Our ops director discovered indeed FreeBSD runs well on the
  Lenovo T420p, except for that pesky 5GHz thing.  So now developers
  also can have a T420p running FreeBSD to do work with.
  Their #1 feedback to me - "boy it'd be nice if 5GHz wifi worked."

* .. then, I was at NANOG but stuck with 5GHz only wifi and no ath(4)
  NIC to put in a laptop - and I snapped.

Thus, the reason this is actually work related.

MFC after:	2 weeks
Sponsored by:	Norse Corp, Inc.
opntr pushed a commit that referenced this issue Jul 9, 2015
The Tp-link Archer-C7v2 unit has a QCA9558 internally but hangs the
QCA988x 11ac PCIe NIC off of PCI RC #1, not #0.

So I actually finally /do/ have a board to verify whether PCIe is working.
Grr.

Tested:

* TP-Link Archer-C7v2.
opntr pushed a commit that referenced this issue Jan 15, 2016
  Fix hwpmc "stalled" behavior

  Currently, there is a single pm_stalled flag that tracks whether a
  performance monitor was "stalled" due to insufficent ring buffer
  space for samples. However, because the same performance monitor
  can run on multiple processes or threads at the same time, a single
  pm_stalled flag that impacts them all seems insufficient.

  In particular, you can hit corner cases where the code fails to stop
  performance monitors during a context switch out, because it thinks
  the performance monitor is already stopped. However, in reality,
  it may be that only the monitor running on a different CPU was stalled.

  This patch attempts to fix that behavior by tracking on a per-CPU basis
  whether a PM desires to run and whether it is "stalled". This lets the
  code make better decisions about when to stop PMs and when to try to
  restart them. Ideally, we should avoid the case where the code fails
  to stop a PM during a context switch out.

MFC r290813:
  Optimizations to the way hwpmc gathers user callchains

  Changes to the code to gather user stacks:
  * Delay setting pmc_cpumask until we actually have the stack.
  * When recording user stack traces, only walk the portion of the ring
    that should have samples for us.

MFC r290929:
  Change the driver stats to what they really are: unsigned values.

  When pmcstat exits after some samples were dropped, give the user an
  idea of how many were lost. (Granted, these are global numbers, but
  they may still help quantify the scope of the loss.)

MFC r290930:
  Improve accuracy of PMC sampling frequency

  The code tracks a counter which is the number of events until the next
  sample. On context switch in, it loads the saved counter. On context
  switch out, it tries to calculate a new saved counter.

  Problems:

  1. The saved counter was shared by all threads in a process. However, this
  means that all threads would be initially loaded with the same saved
  counter. However, that could result in sampling more often than once every
  X number of events.

  2. The calculation to determine a new saved counter was backwards. It
  added when it should have subtracted, and subtracted when it should have
  added. Assume a single-threaded process with a reload count of 1000
  events. Assuming the counter on context switch in was 100 and the counter
  on context switch out was 50 (meaning the thread has "consumed" 50 more
  events), the code would calculate a new saved counter of 150 (instead of
  the proper 50).

  Fix:

  1. As soon as the saved counter is used to initialize a monitor for a
  thread on context switch in, set the saved counter to the reload count.
  That way, subsequent threads to use the saved counter will get the full
  reload count, assuring we sample at least once every X number of events
  (across all threads).

  2. Change the calculation of the saved counter. Due to the change to the
  saved counter in #1, we simply need to add (modulo the reload count) the
  remaining counter time we retrieve from the CPU when a thread is context
  switched out.

MFC r291016:
  Support a wider history counter in pmcstat(8) gmon output

  pmcstat(8) contains an option to output sampling data in a gmon format
  compatible with gprof(1). Currently, it uses the default histcounter,
  which is an (unsigned short). With large sets of sampling data, it
  is possible to overflow the maximum value provided by an (unsigned
  short).

  This change adds the -e argument to pmcstat. If -e and -g are both
  specified, pmcstat will use a histcounter type of uint64_t.

MFC r291017:
  Fix the date on the pmcstat(8) man page from r291016.
opntr added a commit that referenced this issue Aug 19, 2016
unp_dispose and unp_gc could race to teardown the same mbuf chains, which
can lead to dereferencing freed filedesc pointers.

This patch adds an IGNORE_RIGHTS flag on unpcbs marking the unpcb's RIGHTS
as invalid/freed. The flag is protected by UNP_LIST_LOCK.

To serialize against unp_gc, unp_dispose needs the socket object. Change the
dom_dispose() KPI to take a socket object instead of an mbuf chain directly.

PR:		194264
Differential Revision:	https://reviews.freebsd.org/D3044
Reviewed by:	mjg (earlier version)
Approved by:	markj (mentor)
Obtained from:	mjg
MFC after:	1 month
Sponsored by:	EMC / Isilon Storage Division

This commit was never MFCd to 10-STABLE, and the issue is still
reproducible in 2016, with the linked test program from
FreeBSD's phabricator.

--8<--
Unread portion of the kernel message buffer:
[206]
[206]
[206] Fatal trap 9: general protection fault while in kernel mode
[206] cpuid = 1; apic id = 01
[206] instruction pointer       = 0x20:0xffffffff809e10e8
[206] stack pointer             = 0x28:0xfffffe002bd96960
[206] frame pointer             = 0x28:0xfffffe002bd969e0
[206] code segment              = base 0x0, limit 0xfffff, type 0x1b
[206]                   = DPL 0, pres 1, long 1, def32 0, gran 1
[206] processor eflags  = interrupt enabled, resume, IOPL = 0
[206] current process           = 0 (thread taskq)
[206] trap number               = 9
[206] panic: general protection fault
[206] cpuid = 1
[206] KDB: stack backtrace:
[206] #0 0xffffffff8098dc90 at kdb_backtrace+0x60
[206] #1 0xffffffff80953ed6 at vpanic+0x126
[206] #2 0xffffffff80953f63 at panic+0x43
[206] #3 0xffffffff80d6b2cb at trap_fatal+0x36b
[206] #4 0xffffffff80d6af49 at trap+0x839
[206] #5 0xffffffff80d4f3ec at calltrap+0x8
[206] #6 0xffffffff809a2940 at taskqueue_run_locked+0xf0
[206] #7 0xffffffff809a32ab at taskqueue_thread_loop+0x9b
[206] #8 0xffffffff8091c144 at fork_exit+0x84
[206] freebsd#9 0xffffffff80d4f92e at fork_trampoline+0xe
[206] Uptime: 3m26s
[206] Dumping 73 out of 487 MB:..22%..44%..66%..88%
--8<--

(cherry picked from commit 576619e)
Signed-off-by: Oliver Pinter <[email protected]>
CC: Bryan Drewery <[email protected]>
CC: Mark Johnston <[email protected]>
opntr added a commit that referenced this issue Aug 19, 2016
…unix socket. - by markj@

If the listening socket is closed while sonewconn() is executing, the
nascent child socket is aborted, which results in recursion on the
unp_link lock when the child's pru_detach method is invoked. Fix this
by using a flag to mark such sockets, and skip a part of the socket's
teardown during detach.

Reported by:	Raviprakash Darbha <[email protected]>
Tested by:	pho
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D7398

--8<--
[128] panic: __rw_wlock_hard: recursing but non-recursive rw unp_link_rwlock @ /usr/src/sys/kern/uipc_usrreq.c:654
[128]
[128] cpuid = 1
[128] KDB: stack backtrace:
[128] #0 0xffffffff8098dc90 at kdb_backtrace+0x60
[128] #1 0xffffffff80953ed6 at vpanic+0x126
[128] #2 0xffffffff80953da9 at kassert_panic+0x139
[128] #3 0xffffffff80951454 at __rw_wlock_hard+0x394
[128] #4 0xffffffff80951072 at _rw_wlock_cookie+0x92
[128] #5 0xffffffff809de636 at uipc_detach+0x36
[128] #6 0xffffffff809d217a at sofree+0x1da
[128] #7 0xffffffff809d1da4 at sonewconn+0x324
[128] #8 0xffffffff809e0496 at unp_connectat+0x326
[128] freebsd#9 0xffffffff809de4ac at uipc_connect+0x4c
[128] freebsd#10 0xffffffff809d8cf6 at kern_connectat+0x126
[128] freebsd#11 0xffffffff809d8b87 at sys_connect+0x77
[128] freebsd#12 0xffffffff80d6bab4 at amd64_syscall+0x2c4
[128] freebsd#13 0xffffffff80d4f6db at Xfast_syscall+0xfb
[128] Uptime: 2m8s
[128] Dumping 73 out of 487 MB:..22%..44%..66%..88%
--8<--

(cherry picked from commit cfea0ef)
Signed-off-by: Oliver Pinter <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant