Re: [PATCH v2] media: uvcvideo: Do not alloc dev->status

From: Ricardo Ribalda
Date: Thu Dec 15 2022 - 02:59:39 EST


Hi Sergey

Thanks for looking into this

On Thu, 15 Dec 2022 at 02:15, Sergey Senozhatsky
<senozhatsky@xxxxxxxxxxxx> wrote:
>
> On (22/12/14 14:37), Ricardo Ribalda wrote:
> [..]
> > +struct uvc_status_streaming {
> > + u8 button;
> > +} __packed;
> > +
> > +struct uvc_status_control {
> > + u8 bSelector;
> > + u8 bAttribute;
> > + u8 bValue[11];
> > +} __packed;
> > +
> > +struct uvc_status {
> > + u8 bStatusType;
> > + u8 bOriginator;
> > + u8 bEvent;
> > + union {
> > + struct uvc_status_control control;
> > + struct uvc_status_streaming streaming;
> > + };
> > +} __packed;
> > +
> > struct uvc_device {
> > struct usb_device *udev;
> > struct usb_interface *intf;
> > @@ -559,7 +579,7 @@ struct uvc_device {
> > /* Status Interrupt Endpoint */
> > struct usb_host_endpoint *int_ep;
> > struct urb *int_urb;
> > - u8 *status;
> > +
> > struct input_dev *input;
> > char input_phys[64];
> >
> > @@ -572,6 +592,12 @@ struct uvc_device {
> > } async_ctrl;
> >
> > struct uvc_entity *gpio_unit;
> > +
> > + /*
> > + * Ensure that status is aligned, making it safe to use with
> > + * non-coherent DMA.
> > + */
> > + struct uvc_status status __aligned(ARCH_KMALLOC_MINALIGN);
>
> ____cacheline_aligned ?
>
> I don't see anyone using ARCH_KMALLOC_MINALIGN except for slab.h

Seems like cacheline is not good enough:

https://github.com/torvalds/linux/commit/12c4efe3509b8018e76ea3ebda8227cb53bf5887
https://lore.kernel.org/all/20220405135758.774016-1-catalin.marinas@xxxxxxx/

and ARCH_KMALLOC_MINALIGN is what we have today and is working...

But yeah, the name for that define is not the nicest :)

I added Jonathan Cameron, on cc, as he had to deal with something
similar for iio in case we are missing something


ps: and I thought this was an easy change :P

--
Ricardo Ribalda