All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ojaswin Mujoo <ojaswin98@gmail.com>
Cc: linux-staging@lists.linux.dev,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Phil Elwell <phil@raspberrypi.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] staging: vchiq: convert to use a miscdevice
Date: Sat, 11 Sep 2021 13:56:08 +0200	[thread overview]
Message-ID: <YTyZWK2tRRQ73poZ@kroah.com> (raw)
In-Reply-To: <20210911112911.GA17777@ojas>

On Sat, Sep 11, 2021 at 04:59:11PM +0530, Ojaswin Mujoo wrote:
> On Fri, Sep 10, 2021 at 02:05:19PM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Sep 10, 2021 at 05:10:04PM +0530, Ojaswin Mujoo wrote:
> > > On Tue, Sep 07, 2021 at 01:50:45PM +0200, Greg Kroah-Hartman wrote:
> > > > Using a struct class, a cdev, and another device just for a single minor
> > > > device is total overkill.  Just use a dynamic misc device instead,
> > > > saving lots of logic and memory.
> > > 
> > > Hello Greg,
> > > 
> > > I got some time to test this out at my end. This seems to work correctly
> > > however there's a small change in permissions applied to /dev/vchiq that
> > > is causing tests to break.
> > > 
> > > * Permissions before the patch *
> > > $ ls -l /dev/vchiq 
> > > crw-rw---- 1 root video 235, 0 May  7 17:33 vchiq
> > > 
> > > * Permissions after the patch *
> > > $ ls -l /dev/vchiq 
> > > crw------- 1 root root 10, 125 May  7 17:30 vchiq
> > > 
> > > As seen above, after the patch, the cdev is only accessible by root user,
> > > which is causing the tests ($ vchiq_test -f 10) to fail when run as
> > > non-root.
> > 
> > Ah, that's not under the kernel's control, but as you point out, it's a
> > udev issue.
> > 
> > > I believe assigning the permission and "video" group to /dev/vchiq is
> > > handled by udev, in the downstream pi OS, as seen in this line in
> > > /lib/udev/rules.d/10-local-rpi.rules file:
> > > 
> > > SUBSYSTEM=="vchiq", GROUP="video", MODE="0660" 
> > > 
> > > I'm not completely sure how the SUBSYSTEM part is passed to udev from
> > > the kernel modules, however seems like the miscdevice is not notifying
> > > udev correctly (?).
> > 
> > No, the SUBSYSTEM for this device has changed from "vchiq" to "misc".
> > 
> > Having a whole subsystem for just one character device is crazy, which
> > is why I did the kernel change.
> > 
> > Try changing the line in the udev file to:
> > 
> > 	NAME=="vchiq", GROUP="video", MODE="0660"
> > 
> > (SUBSYSTEM changes to NAME) and see if that works both on the newer
> > kernel, and on the older ones as
> > well.
> Hello, thanks for the explanation and pointers.
> 
> The "NAME==vchiq" change doesn't seem to work but I was able to get it
> correctly working by using "KERNEL=vchiq" instead:
> 
>    KERNEL=="vchiq", GROUP="video", MODE="0660"
> 
> I tested this with and without this patch and it works as expected. 

Ah, yes, you are right, I was just guessing, I should have read the udev
documentation :)

Any chance you can send a patch for this to whatever package that file
comes from?

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ojaswin Mujoo <ojaswin98@gmail.com>
Cc: linux-staging@lists.linux.dev,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Phil Elwell <phil@raspberrypi.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] staging: vchiq: convert to use a miscdevice
Date: Sat, 11 Sep 2021 13:56:08 +0200	[thread overview]
Message-ID: <YTyZWK2tRRQ73poZ@kroah.com> (raw)
In-Reply-To: <20210911112911.GA17777@ojas>

On Sat, Sep 11, 2021 at 04:59:11PM +0530, Ojaswin Mujoo wrote:
> On Fri, Sep 10, 2021 at 02:05:19PM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Sep 10, 2021 at 05:10:04PM +0530, Ojaswin Mujoo wrote:
> > > On Tue, Sep 07, 2021 at 01:50:45PM +0200, Greg Kroah-Hartman wrote:
> > > > Using a struct class, a cdev, and another device just for a single minor
> > > > device is total overkill.  Just use a dynamic misc device instead,
> > > > saving lots of logic and memory.
> > > 
> > > Hello Greg,
> > > 
> > > I got some time to test this out at my end. This seems to work correctly
> > > however there's a small change in permissions applied to /dev/vchiq that
> > > is causing tests to break.
> > > 
> > > * Permissions before the patch *
> > > $ ls -l /dev/vchiq 
> > > crw-rw---- 1 root video 235, 0 May  7 17:33 vchiq
> > > 
> > > * Permissions after the patch *
> > > $ ls -l /dev/vchiq 
> > > crw------- 1 root root 10, 125 May  7 17:30 vchiq
> > > 
> > > As seen above, after the patch, the cdev is only accessible by root user,
> > > which is causing the tests ($ vchiq_test -f 10) to fail when run as
> > > non-root.
> > 
> > Ah, that's not under the kernel's control, but as you point out, it's a
> > udev issue.
> > 
> > > I believe assigning the permission and "video" group to /dev/vchiq is
> > > handled by udev, in the downstream pi OS, as seen in this line in
> > > /lib/udev/rules.d/10-local-rpi.rules file:
> > > 
> > > SUBSYSTEM=="vchiq", GROUP="video", MODE="0660" 
> > > 
> > > I'm not completely sure how the SUBSYSTEM part is passed to udev from
> > > the kernel modules, however seems like the miscdevice is not notifying
> > > udev correctly (?).
> > 
> > No, the SUBSYSTEM for this device has changed from "vchiq" to "misc".
> > 
> > Having a whole subsystem for just one character device is crazy, which
> > is why I did the kernel change.
> > 
> > Try changing the line in the udev file to:
> > 
> > 	NAME=="vchiq", GROUP="video", MODE="0660"
> > 
> > (SUBSYSTEM changes to NAME) and see if that works both on the newer
> > kernel, and on the older ones as
> > well.
> Hello, thanks for the explanation and pointers.
> 
> The "NAME==vchiq" change doesn't seem to work but I was able to get it
> correctly working by using "KERNEL=vchiq" instead:
> 
>    KERNEL=="vchiq", GROUP="video", MODE="0660"
> 
> I tested this with and without this patch and it works as expected. 

Ah, yes, you are right, I was just guessing, I should have read the udev
documentation :)

Any chance you can send a patch for this to whatever package that file
comes from?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-09-11 11:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 11:50 [PATCH] staging: vchiq: convert to use a miscdevice Greg Kroah-Hartman
2021-09-07 11:50 ` Greg Kroah-Hartman
2021-09-10 11:40 ` Ojaswin Mujoo
2021-09-10 11:40   ` Ojaswin Mujoo
2021-09-10 12:05   ` Greg Kroah-Hartman
2021-09-10 12:05     ` Greg Kroah-Hartman
2021-09-11 11:29     ` Ojaswin Mujoo
2021-09-11 11:29       ` Ojaswin Mujoo
2021-09-11 11:56       ` Greg Kroah-Hartman [this message]
2021-09-11 11:56         ` Greg Kroah-Hartman
2021-09-11 12:50         ` Ojaswin Mujoo
2021-09-11 12:50           ` Ojaswin Mujoo

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=YTyZWK2tRRQ73poZ@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    --cc=ojaswin98@gmail.com \
    --cc=phil@raspberrypi.com \
    --cc=stefan.wahren@i2se.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 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.