mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
To: Val Packett <val@packett.cool>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Pratham Pratap <pratham.pratap@oss.qualcomm.com>,
	Jack Pham <jack.pham@oss.qualcomm.com>,
	Wesley Cheng <wesley.cheng@oss.qualcomm.com>,
	Peter Chen <peter.chen@oss.qualcomm.com>,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/2] usb: dwc3: qcom: Vote ICC DDR bandwidth based on connected device speed
Date: Tue, 1 Dec 2026 23:51:17 +0530	[thread overview]
Message-ID: <bd837393-0a50-4239-a80f-876345aecbf1@oss.qualcomm.com> (raw)
In-Reply-To: <8ce228b8-b148-4454-866f-64099c34e9ac@packett.cool>



On 12/1/2026 11:28 PM, Val Packett wrote:
> Hi,
> 
> On 11/30/26 2:41 PM, Krishna Kurapati wrote:
>> In host mode the actual transfer speed is not known at probe time. The
>> DDR interconnect bandwidth has historically been voted at the maximum
>> (SuperSpeed) value unconditionally, wasting power when only a
>> Full/High-Speed device is attached.
>>
>> Add a USB notifier that fires on USB_DEVICE_ADD / USB_DEVICE_REMOVE for
>> devices directly attached to the DWC3 root hub.  On addition, inspect
>> all USB 3.x root-hub ports via xhci_portsc_readl(). If at least one
>> SuperSpeed connection is active, vote SS bandwidth, otherwise vote HS
>> bandwidth. On removal, drop the vote back to the idle/unknown level.
>>
>> [..]
>> @@ -749,8 +828,12 @@ static int dwc3_qcom_probe(struct platform_device 
>> *pdev)
>>               qcom->current_role = USB_ROLE_DEVICE;
>>       }
>> -    qcom->dwc.glue_ops = &dwc3_qcom_glue_ops;
>> +    if (qcom->current_role == USB_ROLE_HOST) {
>> +        qcom->host_nb.notifier_call = dwc3_qcom_host_notifier;
>> +        usb_register_notify(&qcom->host_nb);
>> +    }
>> +    qcom->dwc.glue_ops = &dwc3_qcom_glue_ops;
>>       qcom->dwc.dev = dev;
>>       probe_data.dwc = &qcom->dwc;
>>       probe_data.res = &res;
>> [..]
> 
> Seems like it might be registering with a NULL function ptr or something?
> 
> CONFIG_DEBUG_NOTIFIERS's `!func_ptr_is_kernel_text(nb->notifier_call)` 
> check fires when busses are probed upon booting:
> 
> 
> [   17.606811] xhci-hcd xhci-hcd.1.auto: xHCI Host Controller
> [   17.606825] ------------[ cut here ]------------
> [   17.606826] Invalid notifier called!
> [   17.606833] WARNING: kernel/notifier.c:80 at 
> notifier_call_chain+0x80/0x1b0, CPU#0: kworker/0:0/10
> [   17.607029] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:0 Tainted: G     W 
>           7.4.0-rc5-next-20261130-uwu+ #250 PREEMPT(full)
> [   17.607034] Tainted: [W]=WARN
> [   17.607035] Hardware name: Dell Inc. Latitude 7455/0FK7MX, BIOS 
> 2.13.0 09/19/2025
> [   17.607037] Workqueue: events_freezable __dwc3_set_mode
> [   17.607045] pstate: 61400009 (nZCv daif +PAN -UAO -TCO +DIT -SSBS 
> BTYPE=--)
> [   17.607091] Call trace:
> [   17.607093]  notifier_call_chain+0x80/0x1b0 (P)
> [   17.607097]  blocking_notifier_call_chain+0x4c/0x80
> [   17.607100]  usb_notify_add_bus+0x28/0x40
> [   17.607105]  usb_register_bus+0x88/0xb8
> [   17.607111]  usb_add_hcd+0x144/0x4b0
> [   17.607115]  xhci_plat_probe+0x4f4/0x6f0
> 
I did hit a NULL ptr deref when I was testing this but i fixed it before 
sending. I did test this on standalone (dr_mode==host) and 
(dr_mode==otg). Will try to repro this particular crash and fix it 
before sending next version. Thanks for reporting this.

Regards,
Krishna,

      reply	other threads:[~2026-12-01 18:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 17:41 [PATCH RFC 0/2] Support dynamic icc voting based on negotiated usb speed Krishna Kurapati
2026-11-30 17:41 ` [PATCH RFC 1/2] usb: dwc3: qcom: Refactor DDR ICC bandwidth setting into helper Krishna Kurapati
2026-11-30 17:41 ` [PATCH RFC 2/2] usb: dwc3: qcom: Vote ICC DDR bandwidth based on connected device speed Krishna Kurapati
2026-12-01 17:58   ` Val Packett
2026-12-01 18:21     ` Krishna Kurapati [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd837393-0a50-4239-a80f-876345aecbf1@oss.qualcomm.com \
    --to=krishna.kurapati@oss.qualcomm.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jack.pham@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@oss.qualcomm.com \
    --cc=pratham.pratap@oss.qualcomm.com \
    --cc=val@packett.cool \
    --cc=wesley.cheng@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®