Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1517846
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability |
| Date | 2016-11-09 10:30 +0100 |
| Message-ID | <sBxmF-5pf-3@gated-at.bofh.it> (permalink) |
| References | <syzuG-4cJ-7@gated-at.bofh.it> <syzuG-4cJ-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 1 Nov 2016, Lu Baolu wrote:
> +static int __init xdbc_init(void)
> +{
...
> + base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length);
> + if (!base) {
> + xdbc_trace("failed to remap the io address\n");
> + ret = -ENOMEM;
> + goto free_and_quit;
> + }
> +
> + early_iounmap(xdbc.xhci_base, xdbc.xhci_length);
> + xdbc_trace("early mapped IO address released\n");
> +
> + xdbc.xhci_base = base;
> + offset = xhci_find_next_ext_cap(xdbc.xhci_base, 0, XHCI_EXT_CAPS_DEBUG);
> + xdbc.xdbc_reg = (struct xdbc_regs __iomem *)(xdbc.xhci_base + offset);
This is broken. What prevents that
- a printk is in progress on another cpu?
- a printk happens between the unmap and storing the new base ?
Nothing AFAICT. So this needs to be done in a safe way. And just making it
oldbase = xdbc.xhci_base;
base = ioremap(....);
xdbc.xhci_base = base;
early_iounmap(oldbase);
does not work either because the compiler can rightfully cache
xdbc.xhci_base in the write related functions. The same issue with
xdbc.xdbc_reg.
Thanks,
tglx
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/4] usb: early: add support for early printk through USB3 debug port Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
[PATCH v4 4/4] usb: doc: add document for USB3 debug port usage Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
[PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-09 10:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-10 02:20 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-09 10:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-10 02:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Thomas Gleixner <tglx@linutronix.de> - 2016-11-10 10:00 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Peter Zijlstra <peterz@infradead.org> - 2016-11-10 12:50 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 05:40 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Peter Zijlstra <peterz@infradead.org> - 2016-11-11 13:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 03:30 +0100
Re: [PATCH v4 1/4] usb: dbc: early driver for xhci debug capability Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-11 03:50 +0100
[PATCH v4 2/4] x86: add support for earlyprintk via USB3 debug port Lu Baolu <baolu.lu@linux.intel.com> - 2016-11-01 06:10 +0100
csiph-web