All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Max Staudt <mstaudt@chromium.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Ming Lei <tom.leiming@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Yunke Cao <yunkec@chromium.org>, Christoph Hellwig <hch@lst.de>,
	linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v3 2/2] media: uvcvideo: Do not alloc dev->status
Date: Thu, 15 Dec 2022 13:48:37 +0100	[thread overview]
Message-ID: <20221215124837.GA19113@lst.de> (raw)
In-Reply-To: <20221214-uvc-status-alloc-v3-2-9a67616cc549@chromium.org>

On Thu, Dec 15, 2022 at 11:57:19AM +0100, Ricardo Ribalda wrote:
> +	/*
> +	 * Ensure that status is aligned, making it safe to use with
> +	 * non-coherent DMA.
> +	 */
> +	struct uvc_status status __aligned(ARCH_KMALLOC_MINALIGN);

This should be ARCH_DMA_MINALIGN, not ARCH_KMALLOC_MINALIGN.

Note that without an __aligned tag on the next member as well, those
next members might get cache corrupted.

>  
>  	struct input_dev *input;

.. and without also aligning the next member you'll might still
corrupt everything adter the DMAed member.

That's the reason why I generall advocate against playing these
__aligned games as they can easily go wrong if someone reorders
the structure.

  reply	other threads:[~2022-12-15 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 10:57 [PATCH v3 0/2] media: uvcvideo: Code cleanup for dev->status Ricardo Ribalda
2022-12-15 10:57 ` [PATCH v3 1/2] media: uvcvideo: Remove void casting for the status endpoint Ricardo Ribalda
2022-12-15 11:07   ` Ricardo Ribalda
2022-12-15 10:57 ` [PATCH v3 2/2] media: uvcvideo: Do not alloc dev->status Ricardo Ribalda
2022-12-15 12:48   ` Christoph Hellwig [this message]
2022-12-20 22:59     ` Ricardo Ribalda
2022-12-15 15:34 ` [PATCH v3 0/2] media: uvcvideo: Code cleanup for dev->status Alan Stern
2022-12-16  8:55   ` Ricardo Ribalda
2022-12-16 15:45     ` Alan Stern

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=20221215124837.GA19113@lst.de \
    --to=hch@lst.de \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mstaudt@chromium.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@chromium.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tom.leiming@gmail.com \
    --cc=yunkec@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.