Hello,

I'm not a developer, so please take this as a user report. The problem
was found and analysed by Claude (an AI assistant) on my machine: it
read my kernel log and the driver source, and I'm passing on what it
found in case it's useful. I can't judge the code myself, and no fix
has been tested.

Hardware: MacBookPro16,1 (2019, T2).
Kernel: 7.2.11 from t2linux (linux-t2 on Arch). It is tainted: it uses
the out-of-tree t2bce USB stack, and my own modified amdgpu and
apple-gmux modules. The trace below goes through t2bce, so I can't
rule out that it plays a part.

On each of the last four boots that lasted more than a few minutes,
the log shows this warning once:

  t2bce_core 0000:04:00.1: rejecting DMA map of vmalloc memory
  WARNING: ./include/linux/dma-mapping.h:523 at
    usb_hcd_map_urb_for_dma+0x524/0x580, CPU#0: listello-core/1983
  Call Trace:
   usb_hcd_submit_urb+0x321/0xad0
   usb_start_wait_urb+0x9f/0x230
   appletbdrm_send_request+0x67/0xb0 [appletbdrm]
   appletbdrm_primary_plane_helper_atomic_update+0x2d8/0x350 [appletbdrm]
   drm_atomic_helper_commit_planes+0x114/0x330
   ...
   drm_atomic_helper_dirtyfb+0x221/0x320
   drm_mode_dirtyfb_ioctl+0x1ef/0x240

and then, repeatedly:

  appletbdrm 7-6:2.1: [drm] *ERROR* Failed to send message (-11)

That error appeared 5274 times during one session of about 11 days, in
short bursts of up to about 20 per minute. Only the first occurrence
produces the warning, since it is a WARN_ONCE, so it's an assumption
that the later errors have the same cause.

The likely cause: commit aaaa684bab1f ("drm/appletbdrm: Use kvzalloc
for big allocations") allocates the request buffer with kvzalloc().
When memory is fragmented, this can fall back to vmalloc, and that
buffer then goes to usb_bulk_msg(), whose DMA mapping refuses vmalloc
addresses. The same concern was raised by an automated review of that
patch in April, and I couldn't find a reply to it:
https://lore.gitlab.freedesktop.org/drm-ai-reviews/[email protected]/t/

The kvzalloc() call is still present in current mainline (7.4-rc1), in
appletbdrm_primary_plane_helper_begin_fb_access(). I haven't run
mainline on this machine.

The impact seems small: I haven't noticed anything on the Touch Bar,
and the machine stays stable. Presumably a frame is lost when this
happens, so the bar could show stale content until its next redraw.

That automated review suggested kzalloc() with __GFP_RETRY_MAYFAIL, or
usb_alloc_coherent(), as alternatives. I can't say whether either is
right, but I can test a patch on this machine if that helps. I may
need some guidance, and I'd also be using Claude for that.

Thanks for your work on this driver,
Giulio Malitesta

Reply via email to