Re: [Nouveau] no mouse cursor on nv50

2018-06-18 Thread Adam Borowski
On Mon, Jun 18, 2018 at 06:18:34PM +1000, Ben Skeggs wrote:
> On Mon, Jun 18, 2018 at 7:46 AM, Adam Borowski  wrote:
> > On v4.18-rc1, the mouse cursor is missing on my right monitor.
> > Card is G98 [GeForce 8400 GS Rev. 2].
> >
> > I have two monitors: one small landscape 1280x1024 on DVI-I-1 left, and one
> > big 1600x1200 (1200x1600 portrait) on HDMI-1 right.  Curiously, the cursor
> > is missing not only with proper xrandr setup after logging in but even in
> > mirrored mode at the lightdm greeter[1].  How is this even possible if both
> > screens are supposed to be identical?
> >
> > # first bad commit: [5bca1621c07c3ad37b5a4943450a892e18984df0] 
> > drm/nouveau/kms/nv50-: move fb ctxdma tracking into windows
> >
> > Alas, the bad commit can't be easily reverted as there's a lot of further
> > work on the file on question.
> 
> Thanks for the report!  Can you give
> https://github.com/skeggsb/linux/commit/fffdc521f313031b1745a264ec0d5c848c2475d1
> a try and see if it helps the issue you're seeing?

Yay, it works!  Both for mirrored and extended w/ different orientation.


Meow.
-- 
⢀⣴⠾⠻⢶⣦⠀ There's an easy way to tell toy operating systems from real ones.
⣾⠁⢰⠒⠀⣿⡁ Just look at how their shipped fonts display U+1F52B, this makes
⢿⡄⠘⠷⠚⠋⠀ the intended audience obvious.  It's also interesting to see OSes
⠈⠳⣄ go back and forth wrt their intended target.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] no mouse cursor on nv50

2018-06-17 Thread Adam Borowski
Hi!
On v4.18-rc1, the mouse cursor is missing on my right monitor.
Card is G98 [GeForce 8400 GS Rev. 2].

I have two monitors: one small landscape 1280x1024 on DVI-I-1 left, and one
big 1600x1200 (1200x1600 portrait) on HDMI-1 right.  Curiously, the cursor
is missing not only with proper xrandr setup after logging in but even in
mirrored mode at the lightdm greeter[1].  How is this even possible if both
screens are supposed to be identical?

Bisected:
# bad: [ce397d215ccd07b8ae3f71db689aedb85d56ab40] Linux 4.18-rc1
# good: [29dcea88779c856c7dc92040a0c01233263101d4] Linux 4.17
git bisect start 'v4.18-rc1' 'v4.17'
# bad: [1c8c5a9d38f607c0b6fd12c91cbe1a4418762a21] Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
git bisect bad 1c8c5a9d38f607c0b6fd12c91cbe1a4418762a21
# bad: [135c5504a600ff9b06e321694fbcac78a9530cd4] Merge tag 
'drm-next-2018-06-06-1' of git://anongit.freedesktop.org/drm/drm
git bisect bad 135c5504a600ff9b06e321694fbcac78a9530cd4
# good: [5231804cf9e584f3e7e763a0d6d2fffe011c1bce] Merge tag 
'leds_for_4.18-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
git bisect good 5231804cf9e584f3e7e763a0d6d2fffe011c1bce
# good: [315852b422972e6ebb1dfddaadada09e46a2681a] drm: rcar-du: Fix build 
failure
git bisect good 315852b422972e6ebb1dfddaadada09e46a2681a
# good: [ec064d3c6b40697fd72f4b1eeabbf293b7947a04] Merge tag 
'driver-core-4.18-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
git bisect good ec064d3c6b40697fd72f4b1eeabbf293b7947a04
# bad: [ce234ccc03cfee004e168a1ae4b9d0cfb1974a32] Merge tag 
'drm/tegra/for-4.18-rc1' of git://anongit.freedesktop.org/tegra/linux into 
drm-next
git bisect bad ce234ccc03cfee004e168a1ae4b9d0cfb1974a32
# bad: [d7c6e97a32329032ba7af1f53cab2767832fed77] drm/nouveau/kms/nv50-: modify 
base allocation so the code can be split
git bisect bad d7c6e97a32329032ba7af1f53cab2767832fed77
# good: [0a5b97304b9e2cd07c78a399c5395d5fb0118341] drm/nouveau/gr/gf100-: 
virtualise init_sked_hww_esr
git bisect good 0a5b97304b9e2cd07c78a399c5395d5fb0118341
# good: [18d17221dd58741a8590ba0a40a9ded82aa5d619] drm/nouveau/gr/gf100-: 
virtualise r419e00
git bisect good 18d17221dd58741a8590ba0a40a9ded82aa5d619
# good: [e9d03335f604a1123b8de3103ce8e06db4ad777a] drm/nouveau/gr/gp100-: use 
correct registers for zbc colour/depth setup
git bisect good e9d03335f604a1123b8de3103ce8e06db4ad777a
# good: [512fa0b8a398539c3c2db251f6c40da4ef065d09] drm/nouveau/drm/nv50-: 
remove allocation of sw class
git bisect good 512fa0b8a398539c3c2db251f6c40da4ef065d09
# good: [62b290fc7b36e8fec2a370b946d7117c1899b6c1] drm/nouveau/kms/nv50-: fix 
i2c-over-aux on anx9805
git bisect good 62b290fc7b36e8fec2a370b946d7117c1899b6c1
# bad: [a97c530eb968bad8d945d4f64fb550fa37a9d362] drm/nouveau/kms/nv50-: modify 
overlay allocation so the code can be split
git bisect bad a97c530eb968bad8d945d4f64fb550fa37a9d362
# bad: [5bca1621c07c3ad37b5a4943450a892e18984df0] drm/nouveau/kms/nv50-: move 
fb ctxdma tracking into windows
git bisect bad 5bca1621c07c3ad37b5a4943450a892e18984df0
# first bad commit: [5bca1621c07c3ad37b5a4943450a892e18984df0] 
drm/nouveau/kms/nv50-: move fb ctxdma tracking into windows

Alas, the bad commit can't be easily reverted as there's a lot of further
work on the file on question.


Meow!

[1]. It's possible to setup lightdm for proper layout even on the login
screen, but that gives only aesthetic bonus while possibly causing problems
when the layout changes.
-- 
⢀⣴⠾⠻⢶⣦⠀ There's an easy way to tell toy operating systems from real ones.
⣾⠁⢰⠒⠀⣿⡁ Just look at how their shipped fonts display U+1F52B, this makes
⢿⡄⠘⠷⠚⠋⠀ the intended audience obvious.  It's also interesting to see OSes
⠈⠳⣄ go back and forth wrt their intended target.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] nouveau TRAP_M2MF still there on G98

2018-04-04 Thread Adam Borowski
On Wed, Apr 04, 2018 at 03:48:39PM +0300, Māris Nartišs wrote:
> 2018-04-03 23:00 GMT+03:00, Adam Borowski :
> > In commit da5e45e619b3f101420c38b3006a9ae4f3ad19b0
> >
> > yet it is still reproducible for me on 4.16-rc7 and 4.16.0, which already
> > have your fix.  I don't know about earlier versions -- my newer card went
> > into flames just a few days ago, and I replaced it a brand new 8400GS (G98)
> > I happened to have in a dusty closet.  Obviously, I can bisect if that
> > would be helpful, but the error looks the same thus I'm reporting first.
> 
> Unfortunately I will not be able to help you, as patch fixed issue on
> my system and thus I have no means to test anything more. My card is
> G98M [Quadro NVS 160M]. Besides – I'm a geographer not a programmer
> ;-)

And I'm, it seems, servant of a particular cat, all else being secondary. :p

> Still your report makes to question the original commit I was fixing
> (mmu: swap out round for ALIGN). Could you test if going back to
> rounddown fixes problem on your side?
> 
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> @@ -1354,7 +1354,7 @@ nvkm_vmm_get_locked(struct nvkm_vmm *vmm, bool
> getref, bool mapref, bool sparse,
> 
> tail = this->addr + this->size;
> if (vmm->func->page_block && next && next->page != p)
> -   tail = ALIGN_DOWN(tail, vmm->func->page_block);
> +   tail = rounddown(tail, vmm->func->page_block);
> 
> if (addr <= tail && tail - addr >= size) {
> rb_erase(&this->tree, &vmm->free);
> 

Alas, it did work for a few hours, then a total display freeze:

[29982.011795] nouveau :01:00.0: fifo: DMA_PUSHER - ch 2 [Xorg[2667]] get
037d90 put 03a2cc ib_get 01dc ib_put 01dd state 80004861 (err:
INVALID_CMD) push 00704031
[29982.027959] nouveau :01:00.0: fifo: DMA_PUSHER - ch 2 [Xorg[2667]] get
03a2cc put 03a2cc ib_get 01dc ib_put 01f9 state 8000 (err:
INVALID_CMD) push 00406040
[29982.044136] nouveau :01:00.0: gr: DATA_ERROR 0004 [INVALID_VALUE]
[29982.050934] nouveau :01:00.0: gr: 0010 [] ch 2 [001fa31000
Xorg[2667]] subc 2 class 502d mthd 0218 data ff00
[29982.061866] nouveau :01:00.0: gr: DATA_ERROR 0004 [INVALID_VALUE]
[29982.068658] nouveau :01:00.0: gr: 0010 [] ch 2 [001fa31000
Xorg[2667]] subc 2 class 502d mthd 021c data ff00
[29982.079584] nouveau :01:00.0: gr: DATA_ERROR 000c [INVALID_BITFIELD]
[29982.086651] nouveau :01:00.0: gr: 0010 [] ch 2 [001fa31000
Xorg[2667]] subc 2 class 502d mthd 0220 data ff00
[29982.097517] nouveau :01:00.0: fb: trapped write at 00ff00 on
channel 2 [1fa31000 Xorg[2667]] engine 00 [PGRAPH] client 0b [PROP]
subclient 0c [DST2D] reason  [PT_NOT_PRESENT]
[29982.114491] nouveau :01:00.0: gr: TRAP_PROP - TP 0 - 0010
[DST2D_FAULT] - Address 00ff00
[29982.123620] nouveau :01:00.0: gr: TRAP_PROP - TP 0 - e0c: ,
e18: , e1c: , e20: 0011, e24: 0c03
[29982.135365] nouveau :01:00.0: gr: 0020 [] ch 2 [001fa31000
Xorg[2667]] subc 2 class 502d mthd 0860 data ff2e2e2e

I did not observe a TRAP_M2MF, but the above were present in previous
errors, thus it's probably random what happens first.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ 
⢿⡄⠘⠷⠚⠋⠀ ... what's the frequency of that 5V DC?
⠈⠳⣄
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] nouveau TRAP_M2MF still there on G98

2018-04-03 Thread Adam Borowski
Hi!
In commit da5e45e619b3f101420c38b3006a9ae4f3ad19b0:

>  drm/nouveau/mmu: ALIGN_DOWN correct variable
>
>  Commit 7110c89bb8852ff8b0f88ce05b332b3fe22bd11e ("mmu: swap out round
>  for ALIGN") replaced two calls to round/rounddown with ALIGN/ALIGN_DOWN,
>  but erroneously applied ALIGN_DOWN to a different variable (addr) and left
>  intended variable (tail) not rounded/ALIGNed.
>  
>  As a result screen corruption, X lockups are observable. An example of kernel
>  log of affected system with NV98 card where it was bisected:
>  
>  nouveau :01:00.0: gr: TRAP_M2MF 0002 [IN]
>  nouveau :01:00.0: gr: TRAP_M2MF 00320951 47c0  0400
>  nouveau :01:00.0: gr: 0020 [] ch 1 [000fbbe000 DRM] subc 4 class 5039
>  mthd 0100 data 
>  nouveau :01:00.0: fb: trapped read at 004000 on channel 1
>  [0fbbe000 DRM]
>  engine 00 [PGRAPH] client 03 [DISPATCH] subclient 04 [M2M_IN] reason 0006
>  [NULL_DMAOBJ]

yet it is still reproducible for me on 4.16-rc7 and 4.16.0, which already
have your fix.  I don't know about earlier versions -- my newer card went
into flames just a few days ago, and I replaced it a brand new 8400GS (G98)
I happened to have in a dusty closet.  Obviously, I can bisect if that would
be helpful, but the error looks the same thus I'm reporting first.

Card's init:
[7.068779] nouveau :01:00.0: NVIDIA G98 (298200a2)
[7.101622] cfg80211: Loading compiled-in X.509 certificates for regulatory 
database
[7.201089] nouveau :01:00.0: bios: version 62.98.29.00.00
[7.239105] nouveau :01:00.0: bios: M0203T not found
[7.244530] nouveau :01:00.0: bios: M0203E not matched!
[7.250200] nouveau :01:00.0: fb: 512 MiB DDR2
[7.286877] [TTM] Zone  kernel: Available graphics memory: 4084962 kiB
[7.293526] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[7.300170] [TTM] Initializing pool allocator
[7.304637] [TTM] Initializing DMA pool allocator
[7.309469] nouveau :01:00.0: DRM: VRAM: 512 MiB
[7.314518] nouveau :01:00.0: DRM: GART: 1048576 MiB
[7.319933] nouveau :01:00.0: DRM: TMDS table version 2.0
[7.325796] nouveau :01:00.0: DRM: DCB version 4.0
[7.331067] nouveau :01:00.0: DRM: DCB outp 00: 02000300 0028
[7.337596] nouveau :01:00.0: DRM: DCB outp 01: 01000302 00020030
[7.344130] nouveau :01:00.0: DRM: DCB outp 02: 02011332 00020018
[7.350663] nouveau :01:00.0: DRM: DCB outp 03: 04022310 07a20028
[7.357197] nouveau :01:00.0: DRM: DCB conn 00: 1030
[7.362944] nouveau :01:00.0: DRM: DCB conn 01: 2161
[7.368695] nouveau :01:00.0: DRM: DCB conn 02: 0200
[7.375539] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[7.382246] [drm] Driver supports precise vblank timestamp query.
[7.389671] nouveau :01:00.0: DRM: MM: using M2MF for buffer copies
[7.464023] nouveau :01:00.0: DRM: allocated 1600x1200 fb: 0x7, bo 
289517a1
[7.501927] fbcon: nouveaufb (fb0) is primary device
[7.615433] Console: switching to colour frame buffer device 160x64
[7.666358] nouveau :01:00.0: fb0: nouveaufb frame buffer device

Errors:
[ 4008.457182] nouveau :01:00.0: gr: TRAP_M2MF 0002 [IN]
[ 4008.463010] nouveau :01:00.0: gr: TRAP_M2MF 00320251 00f72f00  
04000430
[ 4008.470774] nouveau :01:00.0: gr: 0020 [] ch 2 [001fa31000 
Xorg[2678]] subc 0 class 5039 mthd 0328 data 
[ 4008.481808] nouveau :01:00.0: fb: trapped read at f72000 on channel 
2 [1fa31000 Xorg[2678]] engine 00 [PGRAPH] client 03 [DISPATCH] subclient 04 
[M2M_IN] reason 0003 [PAGE_SYSTEM_ONLY]

[12964.990240] nouveau :01:00.0: fifo: DMA_PUSHER - ch 2 [Xorg[2678]] get 
031500 put 034394 ib_get 0172 ib_put 0173 state 8000e6a0 (err: 
INVALID_CMD) push 00704031
[12965.017230] nouveau :01:00.0: fifo: DMA_PUSHER - ch 2 [Xorg[2678]] get 
03732c put 034394 ib_get 0172 ib_put 0199 state 8000 (err: 
INVALID_CMD) push 00406040
[12965.033547] nouveau :01:00.0: fb: trapped write at 3be000 on channel 
2 [1fa31000 Xorg[2678]] engine 00 [PGRAPH] client 0b [PROP] subclient 0c 
[DST2D] reason 0002 [PAGE_NOT_PRESENT]
[12965.051014] nouveau :01:00.0: gr: TRAP_PROP - TP 0 - 0010 
[DST2D_FAULT] - Address 3be000
[12965.060314] nouveau :01:00.0: gr: TRAP_PROP - TP 0 - e0c: , e18: 
, e1c: , e20: 0011, e24: 0c03
[12965.072241] nouveau :01:00.0: gr: 0020 [] ch 2 [001fa31000 
Xorg[2678]] subc 2 class 502d mthd 0860 data ff020202
[12965.083283] nouveau :01:00.0: fb: trapped write at 3be200 on channel 
2 [1fa31000 Xorg[2678]] engine 00 [PGRAPH] client 0b [PROP] subclient 0c 
[DST2D] reason 0002 [PAGE_NOT_PRESENT]
[12965.100766] nouveau :01:00.0: gr: TRAP_PROP - TP 0 - 0010 
[DST2D_FAULT] - Address 387000
[12965.109989] nouveau :01:00.0: gr: TRAP_PROP - 

Re: [Nouveau] [PATCH v3] drm/nouveau: Move irq setup/teardown to pci ctor/dtor

2018-01-25 Thread Adam Borowski
On Thu, Jan 25, 2018 at 06:29:53PM -0500, Lyude Paul wrote:
> This was made apparent by what appeared to be a regression in the
> mainline kernel that started introducing suspend/resume issues for
> nouveau:
> 
> a0c9259dc4e1 (irq/matrix: Spread interrupts on allocation)

I'm just a dumb user here, but I confirm:
CPU: AMD Phenom II X6 1055T, GPU: GTX 560 Ti
100% fail to resume GPU on 4.15-rc*, 100% ok with your patch.

And that spinning rust hates being repeatedly powered off and on... :/

> ---
> Changes since v2:
>  - Remove teardown, just reuse pci->irq to indicate when we're tearing
>down the driver
> 
>  drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c | 44 
> +-
>  1 file changed, 29 insertions(+), 15 deletions(-)

Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ Imagine there are bandits in your house, your kid is bleeding out,
⢿⡄⠘⠷⠚⠋⠀ the house is on fire, and seven big-ass trumpets are playing in the
⠈⠳⣄ sky.  Your cat demands food.  The priority should be obvious...
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API

2017-12-08 Thread Adam Borowski
On Fri, Dec 08, 2017 at 06:30:34PM +, Ard Biesheuvel wrote:
> Commit be55287aa5b ("drm/nouveau/imem/nv50: embed nvkm_instobj directly
> into nv04_instobj") introduced some new calls to the refcount api to
> the nv50 mapping code. In one particular instance, it does the
> following:
> 
> if (!refcount_inc_not_zero(&iobj->maps)) {
> ...
> refcount_inc(&iobj->maps);
> }
> 
> i.e., it calls refcount_inc() to increment the refcount when it is known
> to be zero, which is explicitly forbidden by the API. Instead, use
> refcount_set() to set it to 1.
> 
> Signed-off-by: Ard Biesheuvel 
> ---

Awesome!  Works for me.

> Apologies if this was already found and fixed. I don't usually follow
> the DRM or nouveau mailing lists.

I see nothing relevant in dri-devel and nouveau archives, except my
complaint (GTX 560 Ti (GF114)):
https://lists.freedesktop.org/archives/nouveau/2017-December/029264.html
and Richard Narron seconding it (MSI GeForce 210):
https://lists.freedesktop.org/archives/nouveau/2017-December/029276.html

>  drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c 
> b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> index 1ba7289684aa..db48a1daca0c 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
> @@ -249,7 +249,7 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
>   iobj->base.memory.ptrs = &nv50_instobj_fast;
>   else
>   iobj->base.memory.ptrs = &nv50_instobj_slow;
> - refcount_inc(&iobj->maps);
> + refcount_set(&iobj->maps, 1);
>   }
>  
>   mutex_unlock(&imem->subdev.mutex);
> -- 

I'm just a dumb user here, my tags don't carry a weight, but Tested-by:.


Meow!
-- 
// If you believe in so-called "intellectual property", please immediately
// cease using counterfeit alphabets.  Instead, contact the nearest temple
// of Amon, whose priests will provide you with scribal services for all
// your writing needs, for Reasonable And Non-Discriminatory prices.
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] nouveau: refcount_t splat on 4.15-rc1 on nv50

2017-12-02 Thread Adam Borowski
Hi guys!
I'm getting the following warn on 4.15-rc1, on GTX 560 Ti:

[9.430433] nouveau :01:00.0: NVIDIA GF114 (0ce000a1)
...
[9.585172] nouveau :01:00.0: bios: version 70.24.2e.00.02
...
[9.772204] nouveau :01:00.0: fb: 1024 MiB GDDR5
[9.777342] [ cut here ]
[9.782106] refcount_t: increment on 0; use-after-free.
[9.787522] WARNING: CPU: 0 PID: 3 at lib/refcount.c:153 
refcount_inc+0x30/0x50
[9.795060] Modules linked in: sha256_generic cfg80211(+) rfkill 
snd_usb_audio snd_usbmidi_lib nouveau(+) video ttm
[9.805756] CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 
4.15.0-rc1-debug-ubsan-00020-gf4707a916107 #1
[9.815215] Hardware name: System manufacturer System Product Name/M4A77T, 
BIOS 240105/18/2011
[9.824420] Workqueue: events work_for_cpu_fn
[9.828915] task: 880226110c80 task.stack: c9c8
[9.830647] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[9.841681] RIP: 0010:refcount_inc+0x30/0x50
[9.846093] RSP: 0018:c9c83808 EFLAGS: 00010296
[9.851458] RAX: 002b RBX:  RCX: 
[9.858763] RDX: 0001 RSI: 0082 RDI: 8378eb8c
[9.866051] RBP: 88021f103fd0 R08: 0199 R09: 880bd500
[9.873330] R10:  R11: 82289a80 R12: 
[9.880621] R13: 8802103a69e0 R14: 88021f103fe0 R15: 88021f103fe0
[9.887909] FS:  () GS:88022fc0() 
knlGS:
[9.896230] CS:  0010 DS:  ES:  CR0: 80050033
[9.902117] CR2: 560476ba CR3: 000225232000 CR4: 06f0
[9.909417] Call Trace:
[9.912106]  nv50_instobj_acquire+0x123/0x1c0 [nouveau]
[9.917565]  ? nvbios_rd08+0x1b/0x70 [nouveau]
[9.922239]  nvkm_instobj_new+0x1e3/0x520 [nouveau]
[9.927353]  ? nvbios_rd08+0x1b/0x70 [nouveau]
[9.932017]  ? nvbios_pll_parse+0x8d7/0xcf0 [nouveau]
[9.937218]  ? kmem_cache_alloc+0x1f0/0x2d0
[9.941624]  nvkm_memory_new+0x4b/0xc0 [nouveau]
[9.946461]  ? nvkm_longopt+0x17/0x60 [nouveau]
[9.951208]  gf100_fb_oneinit+0x7b/0x1c0 [nouveau]
[9.956218]  nvkm_fb_oneinit+0x89/0x2e0 [nouveau]
[9.961144]  nvkm_subdev_init+0x92/0x600 [nouveau]
[9.966085]  ? ktime_get+0x64/0x110
[9.969815]  nvkm_device_init+0x169/0x2a0 [nouveau]
[9.974922]  nvkm_udevice_init+0x7e/0xf0 [nouveau]
[9.979924]  nvkm_object_init+0x6a/0x2e0 [nouveau]
[9.984932]  nvkm_ioctl_new+0x198/0x430 [nouveau]
[9.989846]  ? nvif_vmm_init+0x340/0x340 [nouveau]
[9.994864]  ? nvkm_udevice_rd08+0x90/0x90 [nouveau]
[   10.56]  nvkm_ioctl+0x21e/0x5a0 [nouveau]
[   10.004548]  ? yield_to+0x2b2/0x370
[   10.008257]  nvif_object_init+0xef/0x1b0 [nouveau]
[   10.013281]  nvif_device_init+0x9/0x40 [nouveau]
[   10.018136]  nouveau_cli_init+0x234/0x12f0 [nouveau]
[   10.023253]  ? idr_alloc_cyclic+0x6c/0x110
[   10.027487]  ? _cond_resched+0x1d/0x80
[   10.031366]  ? kmem_cache_alloc+0x1f0/0x2d0
[   10.035790]  nouveau_drm_load+0x71/0xec0 [nouveau]
[   10.040735]  drm_dev_register+0x1b4/0x330
[   10.044872]  ? pci_enable_device_flags+0x155/0x200
[   10.049806]  drm_get_pci_dev+0xde/0x2c0
[   10.053874]  nouveau_drm_probe+0x1b9/0x240 [nouveau]
[   10.058986]  ? __pm_runtime_resume+0x68/0xb0
[   10.063409]  local_pci_probe+0x5e/0xf0
[   10.067300]  work_for_cpu_fn+0x10/0x30
[   10.071183]  process_one_work+0x21a/0x670
[   10.075325]  worker_thread+0x256/0x500
[   10.079208]  ? manage_workers+0x1e0/0x1e0
[   10.083362]  kthread+0x169/0x220
[   10.086730]  ? kthread_create_worker_on_cpu+0x40/0x40
[   10.091933]  ret_from_fork+0x1f/0x30
[   10.095655] Code: ff 84 c0 74 02 5b c3 0f b6 1d 59 b2 a6 01 80 fb 01 77 1c 
83 e3 01 75 ed 48 c7 c7 c8 f1 3f 82 c6 05 41 b2 a6 01 01 e8 50 02 8d ff <0f> ff 
5b c3 0f b6 f3 48 c7 c7 00 16 c7 82 e8 dd 81 0d 00 eb d3 
[   10.114909] ---[ end trace 08f29138ff4259e6 ]---
[   10.119703] hpet1: lost 21 rtc interrupts
[   10.125534] [ cut here ]
[   10.130326] refcount_t: underflow; use-after-free.
[   10.135292] WARNING: CPU: 0 PID: 3 at lib/refcount.c:281 
refcount_dec_not_one+0x68/0x90
[   10.143540] Modules linked in: sha256_generic cfg80211 rfkill snd_usb_audio 
snd_usbmidi_lib nouveau(+) video ttm
[   10.153956] CPU: 0 PID: 3 Comm: kworker/0:0 Tainted: GW
4.15.0-rc1-debug-ubsan-00020-gf4707a916107 #1
[   10.164719] Hardware name: System manufacturer System Product Name/M4A77T, 
BIOS 240105/18/2011
[   10.173929] Workqueue: events work_for_cpu_fn
[   10.178423] task: 880226110c80 task.stack: c9c8
[   10.184488] RIP: 0010:refcount_dec_not_one+0x68/0x90
[   10.189580] RSP: 0018:c9c837f0 EFLAGS: 00010286
[   10.194946] RAX: 0026 RBX:  RCX: 
[   10.202232] RDX: 0001 RSI: 0092 RDI: 8378eb8c
[   10.209512] RBP:

[Nouveau] [PATCH] drm/nouveau: enable interrupts on cards with 32 intr lines

2017-04-02 Thread Adam Borowski
The code attempts to enable them, but hits an undefined behaviour by
shifting by the entire register's width:

int lines = 32;
u32 mask = (1 << lines) - 1;//  on x86
u32 mask = (1 << lines) - 1;//  on arm (32)
u32 mask = (1 << lines) - 1;//  on arm64
u32 mask = (1ULL << lines) - 1; // ffff everywhere

Signed-off-by: Adam Borowski 
---
To be honest, I can't tell the difference other than UBSAN stopping its
complaints, but the current code is obviously wrong.

 drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
index 77c649723ad7..4a57defc99b3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
@@ -164,7 +164,7 @@ static int
 nvkm_gpio_fini(struct nvkm_subdev *subdev, bool suspend)
 {
struct nvkm_gpio *gpio = nvkm_gpio(subdev);
-   u32 mask = (1 << gpio->func->lines) - 1;
+   u32 mask = (1ULL << gpio->func->lines) - 1;
 
gpio->func->intr_mask(gpio, NVKM_GPIO_TOGGLED, mask, 0);
gpio->func->intr_stat(gpio, &mask, &mask);
-- 
2.11.0

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau