Home | History | Annotate | Download | only in linux
History log of /src/sys/external/bsd/drm2/linux/linux_idr.c
RevisionDateAuthorComments
 1.15  19-Dec-2021  riastradh linux/idr: Remove meaningless stray membar.
 1.14  19-Dec-2021  riastradh Teach idr_remove to accept failure.

But teach it to return the data if it succeeds too.
 1.13  19-Dec-2021  riastradh Define idr_init_base.

Nothing actually uses this at the moment, because callers already
specify the base. Not really sure what the point is!
 1.12  27-Aug-2018  riastradh sdt probe naming style.
 1.11  27-Aug-2018  riastradh Work around broken empty expansion of SDT_PROBE* if !KDTRACE_HOOKS.
 1.10  27-Aug-2018  riastradh sdt dtrace probes for linux idr.
 1.9  27-Aug-2018  riastradh Zero-initialize idr cache.
 1.8  27-Aug-2018  riastradh Draft rewrite of idr preload.

Previous idr code assumed every caller would definitely call
idr_preload, idr_alloc, idr_preload_end, but some callers skip
idr_alloc if an intermediate failure happens first, and would
therefore leak idr nodes.

Use a per-lwp single-node cache instead, and print warnings about
leakers.
 1.7  27-Aug-2018  riastradh Add idr_get_next and idr_for_each_entry.
 1.6  26-Jul-2017  riastradh branches: 1.6.2; 1.6.4;
Tweak slightly sketchy logic in linux_idr.

1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.

Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
 1.5  01-Jan-2015  mrg branches: 1.5.10;
due to hangs seen by several folks, for now revert:
http://mail-index.netbsd.org/source-changes/2014/11/04/msg060120.html

Log Message:
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.
 1.4  04-Nov-2014  jmcneill branches: 1.4.2;
This code should be MP-safe. Use IPL_SCHED in place of IPL_DRM/IPL_VM and set
D_MPSAFE flag in cdevsw.
 1.3  16-Jul-2014  riastradh branches: 1.3.4;
Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.
 1.2  18-Mar-2014  riastradh branches: 1.2.2; 1.2.4; 1.2.6;
Merge riastradh-drm2 to HEAD.
 1.1  24-Jul-2013  riastradh branches: 1.1.2;
file linux_idr.c was initially added on branch riastradh-drm2.
 1.1.2.12  15-Jan-2014  riastradh Convert linux_idr(9) to use spin locks.

idr_for_each is unlocked; caller must exclude modifications.

Eventually this should be rewritten with pserialize and a fancy
bitmap algorithm, but this *actually* works for now.
 1.1.2.11  15-Jan-2014  riastradh Revert "Rewrite idr to use a dumber algorithm that admits pserialized use."

This reverts commit 3a389a1cb20777fb73575f0514b96265052ac1ea.

I don't know what I was smoking with this; just need to change the
rwlock to a spin lock and we'll be good!
 1.1.2.10  30-Dec-2013  riastradh Rewrite idr to use a dumber algorithm that admits pserialized use.

drm2 doesn't use them with RCU, but it does use them under spin locks,
so an rwlock is not kosher.

This algorithm is super-dumb, but the idr API has changed upstream,
and this is not performance-critical, so it's not worth investing
time in a better algorithm at the moment.
 1.1.2.9  24-Jul-2013  riastradh Rework error branches of idr_get_new_above.

Return ENOSPC if we're about to overflow int.
 1.1.2.8  24-Jul-2013  riastradh Actually return the new id in idr_get_new_above.
 1.1.2.7  24-Jul-2013  riastradh Work around rb_tree_iterate API botch in linux_idr.c.
 1.1.2.6  24-Jul-2013  riastradh Tweak idr_pre_get.

. No need to test kmem_alloc(n, KM_SLEEP) for NULL.
. Avoid kmem_free with lock held, out of paranoia.
 1.1.2.5  24-Jul-2013  riastradh Add idr_for_each to Linux idr abstraction.
 1.1.2.4  24-Jul-2013  riastradh Implement idr_replace.
 1.1.2.3  24-Jul-2013  riastradh Implement idr_remove_all.
 1.1.2.2  24-Jul-2013  riastradh In linux_idr, move idr_temp access under the write lock.

The atomic swaps were missing memory barriers, but using the rwlock
is easier to understand for now. This should probably use passive
serialization eventually anyway.
 1.1.2.1  24-Jul-2013  riastradh Dumb implementation of a subset of Linux's idr abstraction.

An idr maintains a mapping from integers to data, like file descriptors
to struct file pointers.
 1.2.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1  18-Mar-2014  yamt file linux_idr.c was added on branch yamt-pagecache on 2014-05-22 11:40:56 +0000
 1.2.4.2  18-May-2014  rmind sync with head
 1.2.4.1  18-Mar-2014  rmind file linux_idr.c was added on branch rmind-smpnet on 2014-05-18 17:46:01 +0000
 1.2.2.1  10-Aug-2014  tls Rebase.
 1.3.4.3  03-Dec-2017  jdolecek update from HEAD
 1.3.4.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.4.1  16-Jul-2014  tls file linux_idr.c was added on branch tls-maxphys on 2014-08-20 00:04:22 +0000
 1.4.2.2  28-Aug-2017  skrll Sync with HEAD
 1.4.2.1  06-Apr-2015  skrll Sync with HEAD
 1.5.10.1  01-Sep-2018  martin Pull up following revision(s) (requested by riastradh in ticket #1003):

sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c: revision 1.8
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.10
sys/external/bsd/drm2/drm/drm_scatter.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.2
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.3
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.4
sys/external/bsd/drm2/linux/linux_idr.c: revision 1.6

Pull in upstream commit:
Author: Ville Syrj=E4l=E4 <ville.syrjala%linux.intel.com@localhost>
Date: Mon Jun 9 16:20:46 2014 +0300
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D76520
Tweak slightly sketchy logic in linux_idr.
1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.
Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
Fix error branch in ttm_dma_tt_init to avoid double-free.
Should fix symptom of PR kern/52438, but who knows what underlying
problem causes us to reach the error branch in the first place.
Fix lockdebug_locked annotations.
When thread A grants ownership to thread B waiting with a context,
thread B needs to assert lockdebug_locked; otherwise, when it
releases, lockdebug_unlocked thinks it's releasing an unlocked
ww_mutex.

Fixes LOCKDEBUG failure with radeon noticed by martin@.

more const

XXX: add a NULL init to avoid a GCC 6 maybe uninit warning.

Remove UB from definition of symbols in i915_reg.h
Kernel Undefined Behavior Sanitizer enforces more warnings in build time.
This makes the build fatal in the drm/i915 code in:
- intel_ddi_put_crtc_pll(),
- intel_ddi_clock_get(),
- intel_ddi_pll_enable(),
- intel_ddi_setup_hw_pll_state().
The error message in all the cases says:
error: case label does not reduce to an integer constant
Set the type of the value left shifted to unsigned.
This change is required to build NetBSD/amd64 with KUBSan.
 1.6.4.1  10-Jun-2019  christos Sync with HEAD
 1.6.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed