Linux userland API discussions
 help / color / mirror / Atom feed
* Re: [PATCH 11/11] smack: Implement the watch_key and post_notification hooks [untested] [ver #7]
From: David Howells @ 2019-09-03 18:06 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, viro, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <87bf0363-af77-1e5a-961f-72730e39e3a6@schaufler-ca.com>

Casey Schaufler <casey@schaufler-ca.com> wrote:

> Built from your tree.

What branch?  keys-next?

> keyctl move 483362336 1065401533 @s
> keyctl_move: Operation not supported

Odd.  That should be unconditional if you have CONFIG_KEYS and v5.3-rc1.  Can
you try:

	keyctl supports

or just:

	keyctl add user a a @s

which will give you an id, say 1234, then:

	keyctl move 1234 @s @u

see if that works.

David

^ permalink raw reply

* Re: [PATCH 11/11] smack: Implement the watch_key and post_notification hooks [untested] [ver #7]
From: Casey Schaufler @ 2019-09-03 17:40 UTC (permalink / raw)
  To: David Howells
  Cc: viro, Stephen Smalley, Greg Kroah-Hartman, nicolas.dichtel, raven,
	Christian Brauner, keyrings, linux-usb, linux-security-module,
	linux-fsdevel, linux-api, linux-block, linux-kernel, casey
In-Reply-To: <4910.1567525310@warthog.procyon.org.uk>

On 9/3/2019 8:41 AM, David Howells wrote:
> Casey Schaufler <casey@schaufler-ca.com> wrote:
>
>> I tried running your key tests and they fail in "keyctl/move/valid",
>> with 11 FAILED messages, finally hanging after "UNLINK KEY FROM SESSION".
>> It's possible that my Fedora26 system is somehow incompatible with the
>> tests. I don't see anything in your code that would cause this, as the
>> Smack policy on the system shouldn't restrict any access.
> Can you go into keyutils/tests/keyctl/move/valid/ and grab the test.out file?

Inline below

> I presume you're running with an upstream-ish kernel

Built from your tree. It's possible I've missed an important
CONFIG or two.

>  and a cutting edge
> keyutils installed?

Also built from your tree. 

>
> David

$ cat test.out
++++ BEGINNING TEST
+++ ADD KEYRING
keyctl newring wibble @s
1065401533
+++ ADD KEY
keyctl add user lizard gizzard 1065401533
483362336
+++ LIST KEYRING WITH ONE
keyctl rlist 1065401533
483362336
+++ MOVE KEY 1
keyctl move 483362336 1065401533 @s
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ CHECK KEY LINKAGE
keyctl rlist @s
1065401533
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ CHECK KEY REMOVED
keyctl rlist 1065401533
483362336
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ MOVE KEY 2
keyctl move 483362336 1065401533 @s
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ FORCE MOVE KEY 2
keyctl move -f 483362336 1065401533 @s
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ MOVE KEY 3
keyctl move 483362336 @s 1065401533
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ MOVE KEY 4
keyctl move -f 483362336 @s 1065401533
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0       \_ user: lizard
==============
+++ ADD KEY 2
keyctl add user lizard gizzard @s
898499184
+++ MOVE KEY 5
keyctl move 483362336 1065401533 @s
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0   |   \_ user: lizard
 898499184 --alswrv      0     0   \_ user: lizard
==============
+++ CHECK KEY UNMOVED
keyctl rlist 1065401533
483362336
+++ CHECK KEY UNDISPLACED
keyctl rlist @s
1065401533 898499184
+++ FORCE MOVE KEY 6
keyctl move -f 483362336 1065401533 @s
keyctl_move: Operation not supported
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0   |   \_ user: lizard
 898499184 --alswrv      0     0   \_ user: lizard
==============
+++ CHECK KEY REMOVED
keyctl rlist 1065401533
483362336
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0   |   \_ user: lizard
 898499184 --alswrv      0     0   \_ user: lizard
==============
+++ CHECK KEY DISPLACED
keyctl rlist @s
1065401533 898499184
=== FAILED ===
Session Keyring
 680859405 --alswrv      0     0  keyring: RHTS/keyctl/32472
1065401533 --alswrv      0     0   \_ keyring: wibble
 483362336 --alswrv      0     0   |   \_ user: lizard
 898499184 --alswrv      0     0   \_ user: lizard
==============
+++ UNLINK KEY FROM SESSION
keyctl unlink 483362336 @s
+++ WAITING FOR KEY TO BE UNLINKED
keyctl unlink 483362336 @s
keyctl_unlink: No such file or directory
keyctl unlink 483362336 @s
keyctl_unlink: No such file or directory

...

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Alan Stern @ 2019-09-03 17:17 UTC (permalink / raw)
  To: David Howells
  Cc: Guenter Roeck, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <Pine.LNX.4.44L0.1909031303500.1859-100000@iolanthe.rowland.org>

On Tue, 3 Sep 2019, Alan Stern wrote:

> On Tue, 3 Sep 2019, David Howells wrote:
> 
> > Guenter Roeck <linux@roeck-us.net> wrote:
> > 
> > > > > This added call to usbdev_remove() results in a crash when running
> > > > > the qemu "tosa" emulation. Removing the call fixes the problem.
> > > > 
> > > > Yeah - I'm going to drop the bus notification messages for now.
> > > > 
> > > It is not the bus notification itself causing problems. It is the
> > > call to usbdev_remove().
> > 
> > Unfortunately, I don't know how to fix it and don't have much time to
> > investigate it right now - and it's something that can be added back later.
> 
> The cause of your problem is quite simple:
> 
>  static int usbdev_notify(struct notifier_block *self,
>  			       unsigned long action, void *dev)
>  {
>  	switch (action) {
>  	case USB_DEVICE_ADD:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0);
>  		break;
>  	case USB_DEVICE_REMOVE:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0);
> +		usbdev_remove(dev);
> +		break;
> +	case USB_BUS_ADD:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0);
> +		break;
> +	case USB_BUS_REMOVE:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0);
>  		usbdev_remove(dev);
>  		break;
>  	}
> 
> The original code had usbdev_remove(dev) under the USB_DEVICE_REMOVE
> case.  The patch mistakenly moves it, putting it under the
------------------------------^^^^^

Sorry, I should have said "duplicates" it.

Alan Stern

> USB_BUS_REMOVE case.
> 
> If the usbdev_remove() call were left where it was originally, the 
> problem would be solved.
> 
> Alan Stern

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Alan Stern @ 2019-09-03 17:06 UTC (permalink / raw)
  To: David Howells
  Cc: Guenter Roeck, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <29419.1567528161@warthog.procyon.org.uk>

On Tue, 3 Sep 2019, David Howells wrote:

> Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > > > This added call to usbdev_remove() results in a crash when running
> > > > the qemu "tosa" emulation. Removing the call fixes the problem.
> > > 
> > > Yeah - I'm going to drop the bus notification messages for now.
> > > 
> > It is not the bus notification itself causing problems. It is the
> > call to usbdev_remove().
> 
> Unfortunately, I don't know how to fix it and don't have much time to
> investigate it right now - and it's something that can be added back later.

The cause of your problem is quite simple:

 static int usbdev_notify(struct notifier_block *self,
 			       unsigned long action, void *dev)
 {
 	switch (action) {
 	case USB_DEVICE_ADD:
+		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0);
 		break;
 	case USB_DEVICE_REMOVE:
+		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0);
+		usbdev_remove(dev);
+		break;
+	case USB_BUS_ADD:
+		post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0);
+		break;
+	case USB_BUS_REMOVE:
+		post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0);
 		usbdev_remove(dev);
 		break;
 	}

The original code had usbdev_remove(dev) under the USB_DEVICE_REMOVE
case.  The patch mistakenly moves it, putting it under the
USB_BUS_REMOVE case.

If the usbdev_remove() call were left where it was originally, the 
problem would be solved.

Alan Stern

^ permalink raw reply

* Re: [PATCH 06/11] Add a general, global device notification watch list [ver #7]
From: David Howells @ 2019-09-03 16:41 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: dhowells, viro@zeniv.linux.org.uk, Casey Schaufler,
	Stephen Smalley, Greg Kroah-Hartman, nicolas.dichtel@6wind.com,
	raven@themaw.net, Christian Brauner, keyrings@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <TYAPR01MB454492E48362BED351E797B2D8B90@TYAPR01MB4544.jpnprd01.prod.outlook.com>

Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> wrote:

> It seems to lack modification for arch/arm64.

Fixed.

David

^ permalink raw reply

* Re: [PATCH 04/11] General notification queue with user mmap()'able ring buffer [ver #7]
From: David Howells @ 2019-09-03 16:37 UTC (permalink / raw)
  To: Hillf Danton
  Cc: dhowells, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <20190903085706.7700-1-hdanton@sina.com>

Hillf Danton <hdanton@sina.com> wrote:

> > +	for (i = 0; i < wf->nr_filters; i++) {
> > +		wt = &wf->filters[i];
> > +		if (n->type == wt->type &&
> > +		    (wt->subtype_filter[n->subtype >> 5] &
> > +		     (1U << (n->subtype & 31))) &&
> 
> Replace the pure numbers with something easier to understand.

How about the following:

static bool filter_watch_notification(const struct watch_filter *wf,
				      const struct watch_notification *n)
{
	const struct watch_type_filter *wt;
	unsigned int st_bits = sizeof(wt->subtype_filter[0]) * 8;
	unsigned int st_index = n->subtype / st_bits;
	unsigned int st_bit = 1U << (n->subtype % st_bits);
	int i;

	if (!test_bit(n->type, wf->type_filter))
		return false;

	for (i = 0; i < wf->nr_filters; i++) {
		wt = &wf->filters[i];
		if (n->type == wt->type &&
		    (wt->subtype_filter[st_index] & st_bit) &&
		    (n->info & wt->info_mask) == wt->info_filter)
			return true;
	}

	return false; /* If there is a filter, the default is to reject. */
}

David

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: David Howells @ 2019-09-03 16:29 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: dhowells, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <20190903161202.GB22754@roeck-us.net>

Guenter Roeck <linux@roeck-us.net> wrote:

> > > This added call to usbdev_remove() results in a crash when running
> > > the qemu "tosa" emulation. Removing the call fixes the problem.
> > 
> > Yeah - I'm going to drop the bus notification messages for now.
> > 
> It is not the bus notification itself causing problems. It is the
> call to usbdev_remove().

Unfortunately, I don't know how to fix it and don't have much time to
investigate it right now - and it's something that can be added back later.

David

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Guenter Roeck @ 2019-09-03 16:12 UTC (permalink / raw)
  To: David Howells
  Cc: viro, Casey Schaufler, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <7481.1567526867@warthog.procyon.org.uk>

On Tue, Sep 03, 2019 at 05:07:47PM +0100, David Howells wrote:
> Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > This added call to usbdev_remove() results in a crash when running
> > the qemu "tosa" emulation. Removing the call fixes the problem.
> 
> Yeah - I'm going to drop the bus notification messages for now.
> 
It is not the bus notification itself causing problems. It is the
call to usbdev_remove().

Guenter

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: David Howells @ 2019-09-03 16:07 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: dhowells, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <20190903125129.GA18838@roeck-us.net>

Guenter Roeck <linux@roeck-us.net> wrote:

> This added call to usbdev_remove() results in a crash when running
> the qemu "tosa" emulation. Removing the call fixes the problem.

Yeah - I'm going to drop the bus notification messages for now.

David

^ permalink raw reply

* Re: [PATCH 04/11] General notification queue with user mmap()'able ring buffer [ver #7]
From: David Howells @ 2019-09-03 16:06 UTC (permalink / raw)
  To: Hillf Danton
  Cc: dhowells, viro, Casey Schaufler, Stephen Smalley,
	Greg Kroah-Hartman, nicolas.dichtel, raven, Christian Brauner,
	keyrings, linux-usb, linux-security-module, linux-fsdevel,
	linux-api, linux-block, linux-kernel
In-Reply-To: <20190903085706.7700-1-hdanton@sina.com>

Hillf Danton <hdanton@sina.com> wrote:

> > +	smp_store_release(&buf->meta.head, head);
> 
> Add a line of comment for the paring smp_load_acquire().
> I did not find it in 04/11.

You won't find smp_load_acquire() - it's not in the kernel, though if you look
in the sample, you'll find the corresponding barrier in userspace.  Note that
there's a further implicit barrier you don't see.

I've added the comments:

	/* Barrier against userspace, ordering data read before tail read */
	ring_tail = READ_ONCE(buf->meta.tail);

and:

	/* Barrier against userspace, ordering head update after data write. */
	smp_store_release(&buf->meta.head, head);

David

^ permalink raw reply

* Re: [PATCH 11/11] smack: Implement the watch_key and post_notification hooks [untested] [ver #7]
From: David Howells @ 2019-09-03 15:41 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, viro, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <e36fa722-a300-2abf-ae9c-a0246fc66d0e@schaufler-ca.com>

Casey Schaufler <casey@schaufler-ca.com> wrote:

> I tried running your key tests and they fail in "keyctl/move/valid",
> with 11 FAILED messages, finally hanging after "UNLINK KEY FROM SESSION".
> It's possible that my Fedora26 system is somehow incompatible with the
> tests. I don't see anything in your code that would cause this, as the
> Smack policy on the system shouldn't restrict any access.

Can you go into keyutils/tests/keyctl/move/valid/ and grab the test.out file?

I presume you're running with an upstream-ish kernel and a cutting edge
keyutils installed?

David

^ permalink raw reply

* Re: [PATCH 11/11] smack: Implement the watch_key and post_notification hooks [untested] [ver #7]
From: Casey Schaufler @ 2019-09-03 15:20 UTC (permalink / raw)
  To: David Howells, viro
  Cc: Stephen Smalley, Greg Kroah-Hartman, nicolas.dichtel, raven,
	Christian Brauner, keyrings, linux-usb, linux-security-module,
	linux-fsdevel, linux-api, linux-block, linux-kernel, casey
In-Reply-To: <156717352917.2204.17206219813087348132.stgit@warthog.procyon.org.uk>

On 8/30/2019 6:58 AM, David Howells wrote:
> Implement the watch_key security hook in Smack to make sure that a key
> grants the caller Read permission in order to set a watch on a key.
>
> Also implement the post_notification security hook to make sure that the
> notification source is granted Write permission by the watch queue.
>
> For the moment, the watch_devices security hook is left unimplemented as
> it's not obvious what the object should be since the queue is global and
> didn't previously exist.
>
> Signed-off-by: David Howells <dhowells@redhat.com>

I tried running your key tests and they fail in "keyctl/move/valid",
with 11 FAILED messages, finally hanging after "UNLINK KEY FROM SESSION".
It's possible that my Fedora26 system is somehow incompatible with the
tests. I don't see anything in your code that would cause this, as the
Smack policy on the system shouldn't restrict any access.

> ---
>
>  include/linux/lsm_audit.h  |    1 +
>  security/smack/smack_lsm.c |   82 +++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 82 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
> index 915330abf6e5..734d67889826 100644
> --- a/include/linux/lsm_audit.h
> +++ b/include/linux/lsm_audit.h
> @@ -74,6 +74,7 @@ struct common_audit_data {
>  #define LSM_AUDIT_DATA_FILE	12
>  #define LSM_AUDIT_DATA_IBPKEY	13
>  #define LSM_AUDIT_DATA_IBENDPORT 14
> +#define LSM_AUDIT_DATA_NOTIFICATION 15
>  	union 	{
>  		struct path path;
>  		struct dentry *dentry;
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 4c5e5a438f8b..1c2a908c6446 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -4274,7 +4274,7 @@ static int smack_key_permission(key_ref_t key_ref,
>  	if (tkp == NULL)
>  		return -EACCES;
>  
> -	if (smack_privileged_cred(CAP_MAC_OVERRIDE, cred))
> +	if (smack_privileged(CAP_MAC_OVERRIDE))
>  		return 0;
>  
>  #ifdef CONFIG_AUDIT
> @@ -4320,8 +4320,81 @@ static int smack_key_getsecurity(struct key *key, char **_buffer)
>  	return length;
>  }
>  
> +
> +#ifdef CONFIG_KEY_NOTIFICATIONS
> +/**
> + * smack_watch_key - Smack access to watch a key for notifications.
> + * @key: The key to be watched
> + *
> + * Return 0 if the @watch->cred has permission to read from the key object and
> + * an error otherwise.
> + */
> +static int smack_watch_key(struct key *key)
> +{
> +	struct smk_audit_info ad;
> +	struct smack_known *tkp = smk_of_current();
> +	int rc;
> +
> +	if (key == NULL)
> +		return -EINVAL;
> +	/*
> +	 * If the key hasn't been initialized give it access so that
> +	 * it may do so.
> +	 */
> +	if (key->security == NULL)
> +		return 0;
> +	/*
> +	 * This should not occur
> +	 */
> +	if (tkp == NULL)
> +		return -EACCES;
> +
> +	if (smack_privileged_cred(CAP_MAC_OVERRIDE, current_cred()))
> +		return 0;
> +
> +#ifdef CONFIG_AUDIT
> +	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_KEY);
> +	ad.a.u.key_struct.key = key->serial;
> +	ad.a.u.key_struct.key_desc = key->description;
> +#endif
> +	rc = smk_access(tkp, key->security, MAY_READ, &ad);
> +	rc = smk_bu_note("key watch", tkp, key->security, MAY_READ, rc);
> +	return rc;
> +}
> +#endif /* CONFIG_KEY_NOTIFICATIONS */
>  #endif /* CONFIG_KEYS */
>  
> +#ifdef CONFIG_WATCH_QUEUE
> +/**
> + * smack_post_notification - Smack access to post a notification to a queue
> + * @w_cred: The credentials of the watcher.
> + * @cred: The credentials of the event source (may be NULL).
> + * @n: The notification message to be posted.
> + */
> +static int smack_post_notification(const struct cred *w_cred,
> +				   const struct cred *cred,
> +				   struct watch_notification *n)
> +{
> +	struct smk_audit_info ad;
> +	struct smack_known *subj, *obj;
> +	int rc;
> +
> +	/* Always let maintenance notifications through. */
> +	if (n->type == WATCH_TYPE_META)
> +		return 0;
> +
> +	if (!cred)
> +		return 0;
> +	subj = smk_of_task(smack_cred(cred));
> +	obj = smk_of_task(smack_cred(w_cred));
> +
> +	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NOTIFICATION);
> +	rc = smk_access(subj, obj, MAY_WRITE, &ad);
> +	rc = smk_bu_note("notification", subj, obj, MAY_WRITE, rc);
> +	return rc;
> +}
> +#endif /* CONFIG_WATCH_QUEUE */
> +
>  /*
>   * Smack Audit hooks
>   *
> @@ -4710,8 +4783,15 @@ static struct security_hook_list smack_hooks[] __lsm_ro_after_init = {
>  	LSM_HOOK_INIT(key_free, smack_key_free),
>  	LSM_HOOK_INIT(key_permission, smack_key_permission),
>  	LSM_HOOK_INIT(key_getsecurity, smack_key_getsecurity),
> +#ifdef CONFIG_KEY_NOTIFICATIONS
> +	LSM_HOOK_INIT(watch_key, smack_watch_key),
> +#endif
>  #endif /* CONFIG_KEYS */
>  
> +#ifdef CONFIG_WATCH_QUEUE
> +	LSM_HOOK_INIT(post_notification, smack_post_notification),
> +#endif
> +
>   /* Audit hooks */
>  #ifdef CONFIG_AUDIT
>  	LSM_HOOK_INIT(audit_rule_init, smack_audit_rule_init),
>

^ permalink raw reply

* Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
From: Joel Fernandes @ 2019-09-03 14:21 UTC (permalink / raw)
  To: Michal Koutný
  Cc: Suren Baghdasaryan, Patrick Bellasi, Alessio Balsini,
	Dietmar Eggemann, Morten Rasmussen, Quentin Perret, Paul Turner,
	Steve Muckle, Todd Kjos, Peter Zijlstra, Rafael J . Wysocki,
	Tejun Heo, Vincent Guittot, Viresh Kumar, Juri Lelli, Ingo Molnar,
	cgroups mailinglist, linux-api, LKML, Linux PM
In-Reply-To: <20190903085248.GB8756@blackbody.suse.cz>

On Tue, Sep 3, 2019 at 4:53 AM Michal Koutný <mkoutny@suse.com> wrote:
>
> On Mon, Sep 02, 2019 at 04:02:57PM -0700, Suren Baghdasaryan <surenb@google.com> wrote:
> > > +static inline void cpu_uclamp_print(struct seq_file *sf,
> > > +                                   enum uclamp_id clamp_id)
> > > [...]
> > > +       rcu_read_lock();
> > > +       tg = css_tg(seq_css(sf));
> > > +       util_clamp = tg->uclamp_req[clamp_id].value;
> > > +       rcu_read_unlock();
> > > +
> > > +       if (util_clamp == SCHED_CAPACITY_SCALE) {
> > > +               seq_puts(sf, "max\n");
> > > +               return;
> > > +       }
> > > +
> > > +       percent = tg->uclamp_pct[clamp_id];
> >
> > You are taking RCU lock when accessing tg->uclamp_req but not when
> > accessing tg->uclamp_pct.
> Good point.
>
> > Is that intentional? Can tg be destroyed under you?
> Actually, the rcu_read{,un}lock should be unnecessary in the context of
> the kernfs file op handler -- the tg/css won't go away as long as its
> kernfs file is being worked with.
>

Also, add to that the fact that there is no rcu_dereference() call to
access any of the pointers in the reader or any of its callers. And, I
don't see any "wait for completion" type of pattern here so that
rcu_read_{lock, unlock}() pair does seem useless.

thanks,

 - Joel

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Guenter Roeck @ 2019-09-03 12:51 UTC (permalink / raw)
  To: David Howells
  Cc: viro, Casey Schaufler, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <156717350329.2204.7056537095039252263.stgit@warthog.procyon.org.uk>

On Fri, Aug 30, 2019 at 02:58:23PM +0100, David Howells wrote:
> Add a USB subsystem notification mechanism whereby notifications about
> hardware events such as device connection, disconnection, reset and I/O
> errors, can be reported to a monitoring process asynchronously.
> 
> Firstly, an event queue needs to be created:
> 
> 	fd = open("/dev/event_queue", O_RDWR);
> 	ioctl(fd, IOC_WATCH_QUEUE_SET_SIZE, page_size << n);
> 
> then a notification can be set up to report USB notifications via that
> queue:
> 
> 	struct watch_notification_filter filter = {
> 		.nr_filters = 1,
> 		.filters = {
> 			[0] = {
> 				.type = WATCH_TYPE_USB_NOTIFY,
> 				.subtype_filter[0] = UINT_MAX;
> 			},
> 		},
> 	};
> 	ioctl(fd, IOC_WATCH_QUEUE_SET_FILTER, &filter);
> 	notify_devices(fd, 12);
> 
> After that, records will be placed into the queue when events occur on a
> USB device or bus.  Records are of the following format:
> 
> 	struct usb_notification {
> 		struct watch_notification watch;
> 		__u32	error;
> 		__u32	reserved;
> 		__u8	name_len;
> 		__u8	name[0];
> 	} *n;
> 
> Where:
> 
> 	n->watch.type will be WATCH_TYPE_USB_NOTIFY
> 
> 	n->watch.subtype will be the type of notification, such as
> 	NOTIFY_USB_DEVICE_ADD.
> 
> 	n->watch.info & WATCH_INFO_LENGTH will indicate the length of the
> 	record.
> 
> 	n->watch.info & WATCH_INFO_ID will be the second argument to
> 	device_notify(), shifted.
> 
> 	n->error and n->reserved are intended to convey information such as
> 	error codes, but are currently not used
> 
> 	n->name_len and n->name convey the USB device name as an
> 	unterminated string.  This may be truncated - it is currently
> 	limited to a maximum 63 chars.
> 
> Note that it is permissible for event records to be of variable length -
> or, at least, the length may be dependent on the subtype.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> cc: linux-usb@vger.kernel.org
> ---
> 
>  Documentation/watch_queue.rst    |    9 ++++++
>  drivers/usb/core/Kconfig         |    9 ++++++
>  drivers/usb/core/devio.c         |   56 ++++++++++++++++++++++++++++++++++++++
>  drivers/usb/core/hub.c           |    4 +++
>  include/linux/usb.h              |   18 ++++++++++++
>  include/uapi/linux/watch_queue.h |   30 ++++++++++++++++++++
>  6 files changed, 125 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/watch_queue.rst b/Documentation/watch_queue.rst
> index 5cc9c6924727..4087a8e670a8 100644
> --- a/Documentation/watch_queue.rst
> +++ b/Documentation/watch_queue.rst
> @@ -11,6 +11,8 @@ receive notifications from the kernel.  This can be used in conjunction with::
>  
>      * Block layer event notifications
>  
> +    * USB subsystem event notifications
> +
>  
>  The notifications buffers can be enabled by:
>  
> @@ -315,6 +317,13 @@ Any particular buffer can be fed from multiple sources.  Sources include:
>      or temporary link loss.  Watches of this type are set on the global device
>      watch list.
>  
> +  * WATCH_TYPE_USB_NOTIFY
> +
> +    Notifications of this type indicate USB subsystem events, such as
> +    attachment, removal, reset and I/O errors.  Separate events are generated
> +    for buses and devices.  Watchpoints of this type are set on the global
> +    device watch list.
> +
>  
>  Event Filtering
>  ===============
> diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
> index ecaacc8ed311..57e7b649e48b 100644
> --- a/drivers/usb/core/Kconfig
> +++ b/drivers/usb/core/Kconfig
> @@ -102,3 +102,12 @@ config USB_AUTOSUSPEND_DELAY
>  	  The default value Linux has always had is 2 seconds.  Change
>  	  this value if you want a different delay and cannot modify
>  	  the command line or module parameter.
> +
> +config USB_NOTIFICATIONS
> +	bool "Provide USB hardware event notifications"
> +	depends on USB && DEVICE_NOTIFICATIONS
> +	help
> +	  This option provides support for getting hardware event notifications
> +	  on USB devices and interfaces.  This makes use of the
> +	  /dev/watch_queue misc device to handle the notification buffer.
> +	  device_notify(2) is used to set/remove watches.
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 9063ede411ae..b8572e4d6a1b 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -41,6 +41,7 @@
>  #include <linux/dma-mapping.h>
>  #include <asm/byteorder.h>
>  #include <linux/moduleparam.h>
> +#include <linux/watch_queue.h>
>  
>  #include "usb.h"
>  
> @@ -2660,13 +2661,68 @@ static void usbdev_remove(struct usb_device *udev)
>  	}
>  }
>  
> +#ifdef CONFIG_USB_NOTIFICATIONS
> +static noinline void post_usb_notification(const char *devname,
> +					   enum usb_notification_type subtype,
> +					   u32 error)
> +{
> +	unsigned int gran = WATCH_LENGTH_GRANULARITY;
> +	unsigned int name_len, n_len;
> +	u64 id = 0; /* Might want to put a dev# here. */
> +
> +	struct {
> +		struct usb_notification n;
> +		char more_name[USB_NOTIFICATION_MAX_NAME_LEN -
> +			       (sizeof(struct usb_notification) -
> +				offsetof(struct usb_notification, name))];
> +	} n;
> +
> +	name_len = strlen(devname);
> +	name_len = min_t(size_t, name_len, USB_NOTIFICATION_MAX_NAME_LEN);
> +	n_len = round_up(offsetof(struct usb_notification, name) + name_len,
> +			 gran) / gran;
> +
> +	memset(&n, 0, sizeof(n));
> +	memcpy(n.n.name, devname, n_len);
> +
> +	n.n.watch.type		= WATCH_TYPE_USB_NOTIFY;
> +	n.n.watch.subtype	= subtype;
> +	n.n.watch.info		= n_len;
> +	n.n.error		= error;
> +	n.n.name_len		= name_len;
> +
> +	post_device_notification(&n.n.watch, id);
> +}
> +
> +void post_usb_device_notification(const struct usb_device *udev,
> +				  enum usb_notification_type subtype, u32 error)
> +{
> +	post_usb_notification(dev_name(&udev->dev), subtype, error);
> +}
> +
> +void post_usb_bus_notification(const struct usb_bus *ubus,
> +			       enum usb_notification_type subtype, u32 error)
> +{
> +	post_usb_notification(ubus->bus_name, subtype, error);
> +}
> +#endif
> +
>  static int usbdev_notify(struct notifier_block *self,
>  			       unsigned long action, void *dev)
>  {
>  	switch (action) {
>  	case USB_DEVICE_ADD:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0);
>  		break;
>  	case USB_DEVICE_REMOVE:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0);
> +		usbdev_remove(dev);
> +		break;
> +	case USB_BUS_ADD:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0);
> +		break;
> +	case USB_BUS_REMOVE:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0);
>  		usbdev_remove(dev);

This added call to usbdev_remove() results in a crash when running
the qemu "tosa" emulation. Removing the call fixes the problem.

Guenter

^ permalink raw reply

* Re: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Greg Kroah-Hartman @ 2019-09-03  9:37 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: David Howells, viro@zeniv.linux.org.uk, Casey Schaufler,
	Stephen Smalley, nicolas.dichtel@6wind.com, raven@themaw.net,
	Christian Brauner, keyrings@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <TYAPR01MB4544829484474FC61E850F32D8B90@TYAPR01MB4544.jpnprd01.prod.outlook.com>

On Tue, Sep 03, 2019 at 08:53:31AM +0000, Yoshihiro Shimoda wrote:
> Hi,
> 
> > From: David Howells, Sent: Friday, August 30, 2019 10:58 PM
> <snip>
> > diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> > index 9063ede411ae..b8572e4d6a1b 100644
> > --- a/drivers/usb/core/devio.c
> > +++ b/drivers/usb/core/devio.c
> > @@ -41,6 +41,7 @@
> >  #include <linux/dma-mapping.h>
> >  #include <asm/byteorder.h>
> >  #include <linux/moduleparam.h>
> > +#include <linux/watch_queue.h>
> > 
> >  #include "usb.h"
> > 
> > @@ -2660,13 +2661,68 @@ static void usbdev_remove(struct usb_device *udev)
> >  	}
> >  }
> > 
> > +#ifdef CONFIG_USB_NOTIFICATIONS
> > +static noinline void post_usb_notification(const char *devname,
> > +					   enum usb_notification_type subtype,
> > +					   u32 error)
> > +{
> > +	unsigned int gran = WATCH_LENGTH_GRANULARITY;
> > +	unsigned int name_len, n_len;
> > +	u64 id = 0; /* Might want to put a dev# here. */
> > +
> > +	struct {
> > +		struct usb_notification n;
> > +		char more_name[USB_NOTIFICATION_MAX_NAME_LEN -
> > +			       (sizeof(struct usb_notification) -
> > +				offsetof(struct usb_notification, name))];
> > +	} n;
> > +
> > +	name_len = strlen(devname);
> > +	name_len = min_t(size_t, name_len, USB_NOTIFICATION_MAX_NAME_LEN);
> > +	n_len = round_up(offsetof(struct usb_notification, name) + name_len,
> > +			 gran) / gran;
> > +
> > +	memset(&n, 0, sizeof(n));
> > +	memcpy(n.n.name, devname, n_len);
> > +
> > +	n.n.watch.type		= WATCH_TYPE_USB_NOTIFY;
> > +	n.n.watch.subtype	= subtype;
> > +	n.n.watch.info		= n_len;
> > +	n.n.error		= error;
> > +	n.n.name_len		= name_len;
> > +
> > +	post_device_notification(&n.n.watch, id);
> > +}
> > +
> > +void post_usb_device_notification(const struct usb_device *udev,
> > +				  enum usb_notification_type subtype, u32 error)
> > +{
> > +	post_usb_notification(dev_name(&udev->dev), subtype, error);
> > +}
> > +
> > +void post_usb_bus_notification(const struct usb_bus *ubus,
> 
> This function's argument is struct usb_bus *, but ...
> 
> > +			       enum usb_notification_type subtype, u32 error)
> > +{
> > +	post_usb_notification(ubus->bus_name, subtype, error);
> > +}
> > +#endif
> > +
> >  static int usbdev_notify(struct notifier_block *self,
> >  			       unsigned long action, void *dev)
> >  {
> >  	switch (action) {
> >  	case USB_DEVICE_ADD:
> > +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0);
> >  		break;
> >  	case USB_DEVICE_REMOVE:
> > +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0);
> > +		usbdev_remove(dev);
> > +		break;
> > +	case USB_BUS_ADD:
> > +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0);
> > +		break;
> > +	case USB_BUS_REMOVE:
> > +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0);
> >  		usbdev_remove(dev);
> 
> this function calls usbdev_remove() with incorrect argument if the action
> is USB_BUS_REMOVE. So, this seems to cause the following issue [1] on
> my environment (R-Car H3 / r8a7795 on next-20190902) [2]. However, I have
> no idea how to fix the issue, so I report this issue at the first step.

As a few of us just discussed this on IRC, these bus notifiers should
probably be dropped as these are the incorrect structure type as you
found out.  Thanks for the report.

greg k-h

^ permalink raw reply

* RE: [PATCH 08/11] usb: Add USB subsystem notifications [ver #7]
From: Yoshihiro Shimoda @ 2019-09-03  8:53 UTC (permalink / raw)
  To: David Howells, viro@zeniv.linux.org.uk
  Cc: Casey Schaufler, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel@6wind.com, raven@themaw.net, Christian Brauner,
	keyrings@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-block@vger.kernel.org
In-Reply-To: <156717350329.2204.7056537095039252263.stgit@warthog.procyon.org.uk>

Hi,

> From: David Howells, Sent: Friday, August 30, 2019 10:58 PM
<snip>
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 9063ede411ae..b8572e4d6a1b 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -41,6 +41,7 @@
>  #include <linux/dma-mapping.h>
>  #include <asm/byteorder.h>
>  #include <linux/moduleparam.h>
> +#include <linux/watch_queue.h>
> 
>  #include "usb.h"
> 
> @@ -2660,13 +2661,68 @@ static void usbdev_remove(struct usb_device *udev)
>  	}
>  }
> 
> +#ifdef CONFIG_USB_NOTIFICATIONS
> +static noinline void post_usb_notification(const char *devname,
> +					   enum usb_notification_type subtype,
> +					   u32 error)
> +{
> +	unsigned int gran = WATCH_LENGTH_GRANULARITY;
> +	unsigned int name_len, n_len;
> +	u64 id = 0; /* Might want to put a dev# here. */
> +
> +	struct {
> +		struct usb_notification n;
> +		char more_name[USB_NOTIFICATION_MAX_NAME_LEN -
> +			       (sizeof(struct usb_notification) -
> +				offsetof(struct usb_notification, name))];
> +	} n;
> +
> +	name_len = strlen(devname);
> +	name_len = min_t(size_t, name_len, USB_NOTIFICATION_MAX_NAME_LEN);
> +	n_len = round_up(offsetof(struct usb_notification, name) + name_len,
> +			 gran) / gran;
> +
> +	memset(&n, 0, sizeof(n));
> +	memcpy(n.n.name, devname, n_len);
> +
> +	n.n.watch.type		= WATCH_TYPE_USB_NOTIFY;
> +	n.n.watch.subtype	= subtype;
> +	n.n.watch.info		= n_len;
> +	n.n.error		= error;
> +	n.n.name_len		= name_len;
> +
> +	post_device_notification(&n.n.watch, id);
> +}
> +
> +void post_usb_device_notification(const struct usb_device *udev,
> +				  enum usb_notification_type subtype, u32 error)
> +{
> +	post_usb_notification(dev_name(&udev->dev), subtype, error);
> +}
> +
> +void post_usb_bus_notification(const struct usb_bus *ubus,

This function's argument is struct usb_bus *, but ...

> +			       enum usb_notification_type subtype, u32 error)
> +{
> +	post_usb_notification(ubus->bus_name, subtype, error);
> +}
> +#endif
> +
>  static int usbdev_notify(struct notifier_block *self,
>  			       unsigned long action, void *dev)
>  {
>  	switch (action) {
>  	case USB_DEVICE_ADD:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_ADD, 0);
>  		break;
>  	case USB_DEVICE_REMOVE:
> +		post_usb_device_notification(dev, NOTIFY_USB_DEVICE_REMOVE, 0);
> +		usbdev_remove(dev);
> +		break;
> +	case USB_BUS_ADD:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_ADD, 0);
> +		break;
> +	case USB_BUS_REMOVE:
> +		post_usb_bus_notification(dev, NOTIFY_USB_BUS_REMOVE, 0);
>  		usbdev_remove(dev);

this function calls usbdev_remove() with incorrect argument if the action
is USB_BUS_REMOVE. So, this seems to cause the following issue [1] on
my environment (R-Car H3 / r8a7795 on next-20190902) [2]. However, I have
no idea how to fix the issue, so I report this issue at the first step.

JFYI, even if I have reverted this patch on next-20190902, other issue
appears [3].

[1] The following panic happened.
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd073]
[    0.000000] Linux version 5.3.0-rc6-next-20190902 (shimoda@shimoda-RB02198) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) #47 SMP PREEMPT Tue Sep 3 17:42:01 JST 2019
[    0.000000] Machine model: Renesas Salvator-X board based on r8a7795 ES2.0+
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 32 MiB at 0x00000000be000000
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000048000000-0x000000077fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x77efdb800-0x77efdcfff]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000048000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000077fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000048000000-0x00000000bfffffff]
[    0.000000]   node   0: [mem 0x0000000500000000-0x000000057fffffff]
[    0.000000]   node   0: [mem 0x0000000600000000-0x000000067fffffff]
[    0.000000]   node   0: [mem 0x0000000700000000-0x000000077fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000048000000-0x000000077fffffff]
[    0.000000] On node 0 totalpages: 2064384
[    0.000000]   DMA32 zone: 7680 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 491520 pages, LIFO batch:63
[    0.000000]   Normal zone: 24576 pages used for memmap
[    0.000000]   Normal zone: 1572864 pages, LIFO batch:63
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] percpu: Embedded 22 pages/cpu s52952 r8192 d28968 u90112
[    0.000000] pcpu-alloc: s52952 r8192 d28968 u90112 alloc=22*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5 [0] 6 [0] 7 
[    0.000000] Detected PIPT I-cache on CPU0
[    0.000000] CPU features: detected: EL2 vector hardening
[    0.000000] Speculative Store Bypass Disable mitigation not required
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2032128
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: console=ttySC0,115200 ignore_loglevel consoleblank=0 rw root=/dev/nfs ip=dhcp
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0xba000000-0xbe000000] (64MB)
[    0.000000] Memory: 7972368K/8257536K available (12092K kernel code, 1846K rwdata, 6320K rodata, 4992K init, 450K bss, 252400K reserved, 32768K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=8.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GIC: Adjusting CPU interface base to 0x00000000f102f000
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x2f0/0x490 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 8.33MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1ec02923e, max_idle_ns: 440795202125 ns
[    0.000003] sched_clock: 56 bits at 8MHz, resolution 120ns, wraps every 2199023255496ns
[    0.000142] Console: colour dummy device 80x25
[    0.000211] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.66 BogoMIPS (lpj=33333)
[    0.000218] pid_max: default: 32768 minimum: 301
[    0.000273] LSM: Security Framework initializing
[    0.000351] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.000397] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.023974] ASID allocator initialised with 32768 entries
[    0.031963] rcu: Hierarchical SRCU implementation.
[    0.041031] Detected Renesas R-Car Gen3 r8a7795 ES3.0
[    0.042354] EFI services will not be available.
[    0.047989] smp: Bringing up secondary CPUs ...
[    0.080173] Detected PIPT I-cache on CPU1
[    0.080213] CPU1: Booted secondary processor 0x0000000001 [0x411fd073]
[    0.112190] Detected PIPT I-cache on CPU2
[    0.112210] CPU2: Booted secondary processor 0x0000000002 [0x411fd073]
[    0.144225] Detected PIPT I-cache on CPU3
[    0.144244] CPU3: Booted secondary processor 0x0000000003 [0x411fd073]
[    0.176267] CPU features: detected: ARM erratum 845719
[    0.176278] Detected VIPT I-cache on CPU4
[    0.176316] CPU4: Booted secondary processor 0x0000000100 [0x410fd034]
[    0.208292] Detected VIPT I-cache on CPU5
[    0.208316] CPU5: Booted secondary processor 0x0000000101 [0x410fd034]
[    0.240331] Detected VIPT I-cache on CPU6
[    0.240354] CPU6: Booted secondary processor 0x0000000102 [0x410fd034]
[    0.272365] Detected VIPT I-cache on CPU7
[    0.272389] CPU7: Booted secondary processor 0x0000000103 [0x410fd034]
[    0.272464] smp: Brought up 1 node, 8 CPUs
[    0.272484] SMP: Total of 8 processors activated.
[    0.272488] CPU features: detected: 32-bit EL0 Support
[    0.272493] CPU features: detected: CRC32 instructions
[    0.282612] CPU: All CPU(s) started at EL2
[    0.282644] alternatives: patching kernel code
[    0.283676] devtmpfs: initialized
[    0.289458] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.289471] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
[    0.290163] pinctrl core: initialized pinctrl subsystem
[    0.291360] DMI not present or invalid.
[    0.291607] NET: Registered protocol family 16
[    0.292388] DMA: preallocated 256 KiB pool for atomic allocations
[    0.292399] audit: initializing netlink subsys (disabled)
[    0.292539] audit: type=2000 audit(0.292:1): state=initialized audit_enabled=0 res=1
[    0.293573] cpuidle: using governor menu
[    0.293733] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.294678] Serial: AMBA PL011 UART driver
[    0.296912] sh-pfc e6060000.pin-controller: IRQ index 0 not found
[    0.297125] sh-pfc e6060000.pin-controller: r8a77951_pfc support registered
[    0.317432] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.317439] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.317443] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.317447] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.319199] cryptd: max_cpu_qlen set to 1000
[    0.322091] ACPI: Interpreter disabled.
[    0.325627] iommu: Default domain type: Translated 
[    0.325823] vgaarb: loaded
[    0.326011] SCSI subsystem initialized
[    0.326113] libata version 3.00 loaded.
[    0.326243] usbcore: registered new interface driver usbfs
[    0.326264] usbcore: registered new interface driver hub
[    0.326307] usbcore: registered new device driver usb
[    0.327255] i2c-sh_mobile e60b0000.i2c: I2C adapter 7, bus speed 400000 Hz
[    0.327560] pps_core: LinuxPPS API ver. 1 registered
[    0.327564] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.327573] PTP clock support registered
[    0.327701] EDAC MC: Ver: 3.0.0
[    0.328991] FPGA manager framework
[    0.329031] Advanced Linux Sound Architecture Driver Initialized.
[    0.329497] clocksource: Switched to clocksource arch_sys_counter
[    0.329639] VFS: Disk quotas dquot_6.6.0
[    0.329682] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.329800] pnp: PnP ACPI: disabled
[    0.332764] thermal_sys: Registered thermal governor 'step_wise'
[    0.332767] thermal_sys: Registered thermal governor 'power_allocator'
[    0.333270] NET: Registered protocol family 2
[    0.333558] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.333624] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.333903] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.334489] TCP: Hash tables configured (established 65536 bind 65536)
[    0.334606] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.334714] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.334929] NET: Registered protocol family 1
[    0.335290] RPC: Registered named UNIX socket transport module.
[    0.335295] RPC: Registered udp transport module.
[    0.335299] RPC: Registered tcp transport module.
[    0.335302] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.335311] PCI: CLS 0 bytes, default 64
[    0.336141] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.336377] hw perfevents: enabled with armv8_cortex_a57 PMU driver, 7 counters available
[    0.336799] kvm [1]: IPA Size Limit: 40bits
[    0.337273] kvm [1]: vgic interrupt IRQ1
[    0.337415] kvm [1]: Hyp mode initialized successfully
[    0.341775] Initialise system trusted keyrings
[    0.341864] workingset: timestamp_bits=44 max_order=21 bucket_order=0
[    0.345076] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.345515] NFS: Registering the id_resolver key type
[    0.345532] Key type id_resolver registered
[    0.345535] Key type id_legacy registered
[    0.345544] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.345638] 9p: Installing v9fs 9p2000 file system support
[    0.354995] Key type asymmetric registered
[    0.355001] Asymmetric key parser 'x509' registered
[    0.355027] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.355032] io scheduler mq-deadline registered
[    0.355036] io scheduler kyber registered
[    0.359639] phy_rcar_gen3_usb2 ee0a0200.usb-phy: IRQ index 0 not found
[    0.360346] phy_rcar_gen3_usb2 ee0c0200.usb-phy: IRQ index 0 not found
[    0.366010] gpio_rcar e6050000.gpio: driving 16 GPIOs
[    0.366187] gpio_rcar e6051000.gpio: driving 29 GPIOs
[    0.366348] gpio_rcar e6052000.gpio: driving 15 GPIOs
[    0.366504] gpio_rcar e6053000.gpio: driving 16 GPIOs
[    0.366663] gpio_rcar e6054000.gpio: driving 18 GPIOs
[    0.366816] gpio_rcar e6055000.gpio: driving 26 GPIOs
[    0.366973] gpio_rcar e6055400.gpio: driving 32 GPIOs
[    0.367126] gpio_rcar e6055800.gpio: driving 4 GPIOs
[    0.368571] rcar-pcie fe000000.pcie: host bridge /soc/pcie@fe000000 ranges:
[    0.368596] rcar-pcie fe000000.pcie:    IO 0xfe100000..0xfe1fffff -> 0x00000000
[    0.368613] rcar-pcie fe000000.pcie:   MEM 0xfe200000..0xfe3fffff -> 0xfe200000
[    0.368626] rcar-pcie fe000000.pcie:   MEM 0x30000000..0x37ffffff -> 0x30000000
[    0.368635] rcar-pcie fe000000.pcie:   MEM 0x38000000..0x3fffffff -> 0x38000000
[    0.433003] rcar-pcie fe000000.pcie: PCIe link down
[    0.433148] rcar-pcie ee800000.pcie: host bridge /soc/pcie@ee800000 ranges:
[    0.433165] rcar-pcie ee800000.pcie:    IO 0xee900000..0xee9fffff -> 0x00000000
[    0.433179] rcar-pcie ee800000.pcie:   MEM 0xeea00000..0xeebfffff -> 0xeea00000
[    0.433191] rcar-pcie ee800000.pcie:   MEM 0xc0000000..0xc7ffffff -> 0xc0000000
[    0.433200] rcar-pcie ee800000.pcie:   MEM 0xc8000000..0xcfffffff -> 0xc8000000
[    0.496985] rcar-pcie ee800000.pcie: PCIe link down
[    0.498893] EINJ: ACPI disabled.
[    0.510430] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.512246] SuperH (H)SCI(F) driver initialized
[    0.512568] sh-sci e6550000.serial: IRQ index 1 not found
[    0.512577] sh-sci e6550000.serial: IRQ index 2 not found
[    0.512584] sh-sci e6550000.serial: IRQ index 3 not found
[    0.512591] sh-sci e6550000.serial: IRQ index 4 not found
[    0.512597] sh-sci e6550000.serial: IRQ index 5 not found
[    0.512647] e6550000.serial: ttySC1 at MMIO 0xe6550000 (irq = 34, base_baud = 0) is a hscif
[    0.513065] sh-sci e6e88000.serial: IRQ index 1 not found
[    0.513073] sh-sci e6e88000.serial: IRQ index 2 not found
[    0.513079] sh-sci e6e88000.serial: IRQ index 3 not found
[    0.513086] sh-sci e6e88000.serial: IRQ index 4 not found
[    0.513092] sh-sci e6e88000.serial: IRQ index 5 not found
[    0.513119] e6e88000.serial: ttySC0 at MMIO 0xe6e88000 (irq = 119, base_baud = 0) is a scif
[    1.655695] printk: console [ttySC0] enabled
[    1.660706] msm_serial: driver initialized
[    1.671544] loop: module loaded
[    1.679482] libphy: Fixed MDIO Bus: probed
[    1.683719] tun: Universal TUN/TAP device driver, 1.6
[    1.689559] thunder_xcv, ver 1.0
[    1.692805] thunder_bgx, ver 1.0
[    1.696052] nicpf, ver 1.0
[    1.699373] hclge is initializing
[    1.702688] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.709907] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.715242] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    1.721073] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.727012] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[    1.733971] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.739557] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[    1.747383] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.753636] sky2: driver version 1.30
[    1.758264] VFIO - User Level meta-driver version: 0.3
[    1.764783] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.771320] ehci-pci: EHCI PCI platform driver
[    1.775780] ehci-platform: EHCI generic platform driver
[    1.781335] ehci-platform ee0a0100.usb: EHCI Host Controller
[    1.787016] ehci-platform ee0a0100.usb: new USB bus registered, assigned bus number 1
[    1.794935] ehci-platform ee0a0100.usb: irq 165, io mem 0xee0a0100
[    1.813507] ehci-platform ee0a0100.usb: USB 2.0 started, EHCI 1.10
[    1.820044] hub 1-0:1.0: USB hub found
[    1.823828] hub 1-0:1.0: 1 port detected
[    1.828017] ehci-platform ee0c0100.usb: EHCI Host Controller
[    1.833684] ehci-platform ee0c0100.usb: new USB bus registered, assigned bus number 2
[    1.841560] ehci-platform ee0c0100.usb: irq 166, io mem 0xee0c0100
[    1.861506] ehci-platform ee0c0100.usb: USB 2.0 started, EHCI 1.10
[    1.867940] hub 2-0:1.0: USB hub found
[    1.871704] hub 2-0:1.0: 1 port detected
[    1.875860] ehci-orion: EHCI orion driver
[    1.880049] ehci-exynos: EHCI EXYNOS driver
[    1.884320] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.890509] ohci-pci: OHCI PCI platform driver
[    1.894978] ohci-platform: OHCI generic platform driver
[    1.900444] ohci-platform ee0a0000.usb: Generic Platform OHCI controller
[    1.907159] ohci-platform ee0a0000.usb: new USB bus registered, assigned bus number 3
[    1.915025] ohci-platform ee0a0000.usb: irq 165, io mem 0xee0a0000
[    2.008477] hub 3-0:1.0: USB hub found
[    2.012244] hub 3-0:1.0: 1 port detected
[    2.016388] ohci-platform ee0c0000.usb: Generic Platform OHCI controller
[    2.023097] ohci-platform ee0c0000.usb: new USB bus registered, assigned bus number 4
[    2.030977] ohci-platform ee0c0000.usb: irq 166, io mem 0xee0c0000
[    2.124457] hub 4-0:1.0: USB hub found
[    2.128220] hub 4-0:1.0: 1 port detected
[    2.132361] ohci-exynos: OHCI EXYNOS driver
[    2.137069] xhci-hcd ee000000.usb: xHCI Host Controller
[    2.142305] xhci-hcd ee000000.usb: new USB bus registered, assigned bus number 5
[    2.149748] xhci-hcd ee000000.usb: Direct firmware load for r8a779x_usb3_v3.dlmem failed with error -2
[    2.159063] xhci-hcd ee000000.usb: can't setup: -2
[    2.163861] xhci-hcd ee000000.usb: USB bus 5 deregistered
[    2.169266] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
[    2.178042] Mem abort info:
[    2.180828]   ESR = 0x96000004
[    2.183876]   EC = 0x25: DABT (current EL), IL = 32 bits
[    2.189179]   SET = 0, FnV = 0
[    2.192226]   EA = 0, S1PTW = 0
[    2.195358] Data abort info:
[    2.198231]   ISV = 0, ISS = 0x00000004
[    2.202058]   CM = 0, WnR = 0
[    2.205019] [0000000000000020] user address but active_mm is swapper
[    2.211366] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    2.216930] Modules linked in:
[    2.219981] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.3.0-rc6-next-20190902 #47
[    2.227456] Hardware name: Renesas Salvator-X board based on r8a7795 ES2.0+ (DT)
[    2.234844] pstate: a0000085 (NzCv daIf -PAN -UAO)
[    2.239638] pc : _raw_write_lock+0x68/0x288
[    2.243819] lr : destroy_async+0x20/0xb0
[    2.247733] sp : ffff80001006b9b0
[    2.251040] x29: ffff80001006b9b0 x28: ffff800011186fd8 
[    2.256345] x27: ffff800011186fc0 x26: 00000000ffffffed 
[    2.261650] x25: ffff8000118ff570 x24: ffff8000118ff000 
[    2.266955] x23: 0000000000000004 x22: ffff800011900000 
[    2.272259] x21: 0000000000000020 x20: 0000000000000028 
[    2.277564] x19: 0000000000000000 x18: 0000000000000005 
[    2.282868] x17: 0000000000000020 x16: ffff800010d164b0 
[    2.288172] x15: ffff8000118ff6e8 x14: ffff000735867958 
[    2.293476] x13: 0000000000000000 x12: ffff8000118ff6e8 
[    2.298779] x11: ffff000735867908 x10: 0000000000000040 
[    2.304083] x9 : ffff8000118ff6f0 x8 : ffff8000118ff6e8 
[    2.309388] x7 : ffff000735867958 x6 : 0000000000000000 
[    2.314691] x5 : 0000000000000001 x4 : 0000000000000000 
[    2.319995] x3 : 0000000000000020 x2 : 0000000000000001 
[    2.325299] x1 : 0000000000000000 x0 : 0000000000000001 
[    2.330604] Call trace:
[    2.333045]  _raw_write_lock+0x68/0x288
[    2.336874]  destroy_async+0x20/0xb0
[    2.340443]  usbdev_remove+0x3c/0xc0
[    2.344011]  usbdev_notify+0x20/0x38
[    2.347583]  notifier_call_chain+0x54/0x98
[    2.351672]  blocking_notifier_call_chain+0x48/0x70
[    2.356543]  usb_notify_remove_bus+0x1c/0x28
[    2.360808]  usb_deregister_bus+0x58/0x68
[    2.364811]  usb_add_hcd+0x234/0x730
[    2.368381]  xhci_plat_probe+0x4ec/0x650
[    2.372302]  platform_drv_probe+0x50/0xa0
[    2.376305]  really_probe+0xdc/0x350
[    2.379874]  driver_probe_device+0x58/0x100
[    2.384050]  device_driver_attach+0x6c/0x90
[    2.388226]  __driver_attach+0x84/0xc8
[    2.391968]  bus_for_each_dev+0x74/0xc8
[    2.395796]  driver_attach+0x20/0x28
[    2.399365]  bus_add_driver+0x148/0x1f0
[    2.403193]  driver_register+0x60/0x110
[    2.407022]  __platform_driver_register+0x40/0x48
[    2.411723]  xhci_plat_init+0x2c/0x34
[    2.415380]  do_one_initcall+0x5c/0x1b0
[    2.419213]  kernel_init_freeable+0x1a4/0x24c
[    2.423564]  kernel_init+0x10/0x108
[    2.427045]  ret_from_fork+0x10/0x18
[    2.430617] Code: 97d3f2b6 a8c17bfd d65f03c0 f9800071 (885ffc60) 
[    2.436717] ---[ end trace 33e4fb349eb48047 ]---
[    2.441345] note: swapper/0[1] exited with preempt_count 1
[    2.446846] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.454497] SMP: stopping secondary CPUs
[    2.458416] Kernel Offset: disabled
[    2.461898] CPU features: 0x0002,21006004
[    2.465899] Memory Limit: none
[    2.468950] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

[2] I'm using defconfig on arch/arm64 and disable CONFIG_FW_LOADER_USER_HELPER.

[3] The following panic happened when I reverted the commit ef9cc255c9539288f119156412d23a4b785f3599
    on next-20190902.
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd073]
[    0.000000] Linux version 5.3.0-rc6-next-20190902-00001-g9709468 (shimoda@shimoda-RB02198) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) #48 SMP PREEMPT Tue Sep 3 17:46:54 JST 2019
[    0.000000] Machine model: Renesas Salvator-X board based on r8a7795 ES2.0+
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 32 MiB at 0x00000000be000000
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000048000000-0x000000077fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x77efdb800-0x77efdcfff]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000048000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000077fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000048000000-0x00000000bfffffff]
[    0.000000]   node   0: [mem 0x0000000500000000-0x000000057fffffff]
[    0.000000]   node   0: [mem 0x0000000600000000-0x000000067fffffff]
[    0.000000]   node   0: [mem 0x0000000700000000-0x000000077fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000048000000-0x000000077fffffff]
[    0.000000] On node 0 totalpages: 2064384
[    0.000000]   DMA32 zone: 7680 pages used for memmap
[    0.000000]   DMA32 zone: 0 pages reserved
[    0.000000]   DMA32 zone: 491520 pages, LIFO batch:63
[    0.000000]   Normal zone: 24576 pages used for memmap
[    0.000000]   Normal zone: 1572864 pages, LIFO batch:63
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] percpu: Embedded 22 pages/cpu s52952 r8192 d28968 u90112
[    0.000000] pcpu-alloc: s52952 r8192 d28968 u90112 alloc=22*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [0] 4 [0] 5 [0] 6 [0] 7 
[    0.000000] Detected PIPT I-cache on CPU0
[    0.000000] CPU features: detected: EL2 vector hardening
[    0.000000] Speculative Store Bypass Disable mitigation not required
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2032128
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: console=ttySC0,115200 ignore_loglevel consoleblank=0 rw root=/dev/nfs ip=dhcp
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0xba000000-0xbe000000] (64MB)
[    0.000000] Memory: 7972368K/8257536K available (12092K kernel code, 1846K rwdata, 6320K rodata, 4992K init, 450K bss, 252400K reserved, 32768K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=8.
[    0.000000] 	Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GIC: Adjusting CPU interface base to 0x00000000f102f000
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x2f0/0x490 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 8.33MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1ec02923e, max_idle_ns: 440795202125 ns
[    0.000002] sched_clock: 56 bits at 8MHz, resolution 120ns, wraps every 2199023255496ns
[    0.000141] Console: colour dummy device 80x25
[    0.000207] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.66 BogoMIPS (lpj=33333)
[    0.000215] pid_max: default: 32768 minimum: 301
[    0.000270] LSM: Security Framework initializing
[    0.000352] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.000398] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.023978] ASID allocator initialised with 32768 entries
[    0.031968] rcu: Hierarchical SRCU implementation.
[    0.041040] Detected Renesas R-Car Gen3 r8a7795 ES3.0
[    0.042364] EFI services will not be available.
[    0.047996] smp: Bringing up secondary CPUs ...
[    0.080183] Detected PIPT I-cache on CPU1
[    0.080222] CPU1: Booted secondary processor 0x0000000001 [0x411fd073]
[    0.112195] Detected PIPT I-cache on CPU2
[    0.112216] CPU2: Booted secondary processor 0x0000000002 [0x411fd073]
[    0.144232] Detected PIPT I-cache on CPU3
[    0.144253] CPU3: Booted secondary processor 0x0000000003 [0x411fd073]
[    0.176276] CPU features: detected: ARM erratum 845719
[    0.176286] Detected VIPT I-cache on CPU4
[    0.176324] CPU4: Booted secondary processor 0x0000000100 [0x410fd034]
[    0.208297] Detected VIPT I-cache on CPU5
[    0.208321] CPU5: Booted secondary processor 0x0000000101 [0x410fd034]
[    0.240338] Detected VIPT I-cache on CPU6
[    0.240361] CPU6: Booted secondary processor 0x0000000102 [0x410fd034]
[    0.272375] Detected VIPT I-cache on CPU7
[    0.272398] CPU7: Booted secondary processor 0x0000000103 [0x410fd034]
[    0.272473] smp: Brought up 1 node, 8 CPUs
[    0.272492] SMP: Total of 8 processors activated.
[    0.272497] CPU features: detected: 32-bit EL0 Support
[    0.272502] CPU features: detected: CRC32 instructions
[    0.282749] CPU: All CPU(s) started at EL2
[    0.282777] alternatives: patching kernel code
[    0.283815] devtmpfs: initialized
[    0.289644] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.289659] futex hash table entries: 2048 (order: 5, 131072 bytes, linear)
[    0.290353] pinctrl core: initialized pinctrl subsystem
[    0.291538] DMI not present or invalid.
[    0.291777] NET: Registered protocol family 16
[    0.292561] DMA: preallocated 256 KiB pool for atomic allocations
[    0.292571] audit: initializing netlink subsys (disabled)
[    0.292709] audit: type=2000 audit(0.292:1): state=initialized audit_enabled=0 res=1
[    0.293743] cpuidle: using governor menu
[    0.293898] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.294862] Serial: AMBA PL011 UART driver
[    0.297061] sh-pfc e6060000.pin-controller: IRQ index 0 not found
[    0.297280] sh-pfc e6060000.pin-controller: r8a77951_pfc support registered
[    0.317490] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.317498] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.317503] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.317506] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.319278] cryptd: max_cpu_qlen set to 1000
[    0.322162] ACPI: Interpreter disabled.
[    0.325707] iommu: Default domain type: Translated 
[    0.325909] vgaarb: loaded
[    0.326100] SCSI subsystem initialized
[    0.326199] libata version 3.00 loaded.
[    0.326333] usbcore: registered new interface driver usbfs
[    0.326353] usbcore: registered new interface driver hub
[    0.326395] usbcore: registered new device driver usb
[    0.327336] i2c-sh_mobile e60b0000.i2c: I2C adapter 7, bus speed 400000 Hz
[    0.327631] pps_core: LinuxPPS API ver. 1 registered
[    0.327636] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.327644] PTP clock support registered
[    0.327770] EDAC MC: Ver: 3.0.0
[    0.329047] FPGA manager framework
[    0.329089] Advanced Linux Sound Architecture Driver Initialized.
[    0.329548] clocksource: Switched to clocksource arch_sys_counter
[    0.329696] VFS: Disk quotas dquot_6.6.0
[    0.329738] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.329855] pnp: PnP ACPI: disabled
[    0.332843] thermal_sys: Registered thermal governor 'step_wise'
[    0.332845] thermal_sys: Registered thermal governor 'power_allocator'
[    0.333337] NET: Registered protocol family 2
[    0.333618] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes, linear)
[    0.333682] TCP established hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.333961] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.334551] TCP: Hash tables configured (established 65536 bind 65536)
[    0.334661] UDP hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.334769] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes, linear)
[    0.334979] NET: Registered protocol family 1
[    0.335329] RPC: Registered named UNIX socket transport module.
[    0.335333] RPC: Registered udp transport module.
[    0.335337] RPC: Registered tcp transport module.
[    0.335340] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.335349] PCI: CLS 0 bytes, default 64
[    0.336179] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.336413] hw perfevents: enabled with armv8_cortex_a57 PMU driver, 7 counters available
[    0.336837] kvm [1]: IPA Size Limit: 40bits
[    0.337313] kvm [1]: vgic interrupt IRQ1
[    0.337458] kvm [1]: Hyp mode initialized successfully
[    0.341834] Initialise system trusted keyrings
[    0.341924] workingset: timestamp_bits=44 max_order=21 bucket_order=0
[    0.345148] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.345585] NFS: Registering the id_resolver key type
[    0.345602] Key type id_resolver registered
[    0.345606] Key type id_legacy registered
[    0.345615] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.345714] 9p: Installing v9fs 9p2000 file system support
[    0.354814] Key type asymmetric registered
[    0.354819] Asymmetric key parser 'x509' registered
[    0.354844] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.354849] io scheduler mq-deadline registered
[    0.354853] io scheduler kyber registered
[    0.359476] phy_rcar_gen3_usb2 ee0a0200.usb-phy: IRQ index 0 not found
[    0.360174] phy_rcar_gen3_usb2 ee0c0200.usb-phy: IRQ index 0 not found
[    0.365881] gpio_rcar e6050000.gpio: driving 16 GPIOs
[    0.366057] gpio_rcar e6051000.gpio: driving 29 GPIOs
[    0.366222] gpio_rcar e6052000.gpio: driving 15 GPIOs
[    0.366376] gpio_rcar e6053000.gpio: driving 16 GPIOs
[    0.366536] gpio_rcar e6054000.gpio: driving 18 GPIOs
[    0.366688] gpio_rcar e6055000.gpio: driving 26 GPIOs
[    0.366860] gpio_rcar e6055400.gpio: driving 32 GPIOs
[    0.367015] gpio_rcar e6055800.gpio: driving 4 GPIOs
[    0.368473] rcar-pcie fe000000.pcie: host bridge /soc/pcie@fe000000 ranges:
[    0.368498] rcar-pcie fe000000.pcie:    IO 0xfe100000..0xfe1fffff -> 0x00000000
[    0.368514] rcar-pcie fe000000.pcie:   MEM 0xfe200000..0xfe3fffff -> 0xfe200000
[    0.368527] rcar-pcie fe000000.pcie:   MEM 0x30000000..0x37ffffff -> 0x30000000
[    0.368536] rcar-pcie fe000000.pcie:   MEM 0x38000000..0x3fffffff -> 0x38000000
[    0.437037] rcar-pcie fe000000.pcie: PCIe link down
[    0.437187] rcar-pcie ee800000.pcie: host bridge /soc/pcie@ee800000 ranges:
[    0.437205] rcar-pcie ee800000.pcie:    IO 0xee900000..0xee9fffff -> 0x00000000
[    0.437218] rcar-pcie ee800000.pcie:   MEM 0xeea00000..0xeebfffff -> 0xeea00000
[    0.437230] rcar-pcie ee800000.pcie:   MEM 0xc0000000..0xc7ffffff -> 0xc0000000
[    0.437239] rcar-pcie ee800000.pcie:   MEM 0xc8000000..0xcfffffff -> 0xc8000000
[    0.501036] rcar-pcie ee800000.pcie: PCIe link down
[    0.502959] EINJ: ACPI disabled.
[    0.514458] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.516285] SuperH (H)SCI(F) driver initialized
[    0.516608] sh-sci e6550000.serial: IRQ index 1 not found
[    0.516616] sh-sci e6550000.serial: IRQ index 2 not found
[    0.516624] sh-sci e6550000.serial: IRQ index 3 not found
[    0.516630] sh-sci e6550000.serial: IRQ index 4 not found
[    0.516637] sh-sci e6550000.serial: IRQ index 5 not found
[    0.516685] e6550000.serial: ttySC1 at MMIO 0xe6550000 (irq = 34, base_baud = 0) is a hscif
[    0.517112] sh-sci e6e88000.serial: IRQ index 1 not found
[    0.517121] sh-sci e6e88000.serial: IRQ index 2 not found
[    0.517128] sh-sci e6e88000.serial: IRQ index 3 not found
[    0.517134] sh-sci e6e88000.serial: IRQ index 4 not found
[    0.517140] sh-sci e6e88000.serial: IRQ index 5 not found
[    0.517169] e6e88000.serial: ttySC0 at MMIO 0xe6e88000 (irq = 119, base_baud = 0) is a scif
[    1.661047] printk: console [ttySC0] enabled
[    1.666084] msm_serial: driver initialized
[    1.676874] loop: module loaded
[    1.684780] libphy: Fixed MDIO Bus: probed
[    1.689023] tun: Universal TUN/TAP device driver, 1.6
[    1.694842] thunder_xcv, ver 1.0
[    1.698099] thunder_bgx, ver 1.0
[    1.701336] nicpf, ver 1.0
[    1.704657] hclge is initializing
[    1.707971] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.715189] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.720525] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    1.726355] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.732292] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[    1.739250] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.744836] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[    1.752662] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.758910] sky2: driver version 1.30
[    1.763530] VFIO - User Level meta-driver version: 0.3
[    1.770067] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.776596] ehci-pci: EHCI PCI platform driver
[    1.781050] ehci-platform: EHCI generic platform driver
[    1.786609] ehci-platform ee0a0100.usb: EHCI Host Controller
[    1.792287] ehci-platform ee0a0100.usb: new USB bus registered, assigned bus number 1
[    1.800200] ehci-platform ee0a0100.usb: irq 165, io mem 0xee0a0100
[    1.821568] ehci-platform ee0a0100.usb: USB 2.0 started, EHCI 1.10
[    1.828087] hub 1-0:1.0: USB hub found
[    1.831856] hub 1-0:1.0: 1 port detected
[    1.836044] ehci-platform ee0c0100.usb: EHCI Host Controller
[    1.841711] ehci-platform ee0c0100.usb: new USB bus registered, assigned bus number 2
[    1.849592] ehci-platform ee0c0100.usb: irq 166, io mem 0xee0c0100
[    1.869555] ehci-platform ee0c0100.usb: USB 2.0 started, EHCI 1.10
[    1.875993] hub 2-0:1.0: USB hub found
[    1.879757] hub 2-0:1.0: 1 port detected
[    1.883910] ehci-orion: EHCI orion driver
[    1.888098] ehci-exynos: EHCI EXYNOS driver
[    1.892371] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.898562] ohci-pci: OHCI PCI platform driver
[    1.903033] ohci-platform: OHCI generic platform driver
[    1.908496] ohci-platform ee0a0000.usb: Generic Platform OHCI controller
[    1.915209] ohci-platform ee0a0000.usb: new USB bus registered, assigned bus number 3
[    1.923072] ohci-platform ee0a0000.usb: irq 165, io mem 0xee0a0000
[    2.016534] hub 3-0:1.0: USB hub found
[    2.020298] hub 3-0:1.0: 1 port detected
[    2.024438] ohci-platform ee0c0000.usb: Generic Platform OHCI controller
[    2.031147] ohci-platform ee0c0000.usb: new USB bus registered, assigned bus number 4
[    2.039026] ohci-platform ee0c0000.usb: irq 166, io mem 0xee0c0000
[    2.132519] hub 4-0:1.0: USB hub found
[    2.136281] hub 4-0:1.0: 1 port detected
[    2.140417] ohci-exynos: OHCI EXYNOS driver
[    2.145110] xhci-hcd ee000000.usb: xHCI Host Controller
[    2.150344] xhci-hcd ee000000.usb: new USB bus registered, assigned bus number 5
[    2.157782] xhci-hcd ee000000.usb: Direct firmware load for r8a779x_usb3_v3.dlmem failed with error -2
[    2.167098] xhci-hcd ee000000.usb: can't setup: -2
[    2.171895] xhci-hcd ee000000.usb: USB bus 5 deregistered
[    2.177324] xhci-hcd: probe of ee000000.usb failed with error -2
[    2.183655] usbcore: registered new interface driver usb-storage
[    2.192417] i2c /dev entries driver
[    2.203824] cs2000-cp 2-004f: revision - C1
[    2.208051] i2c-rcar e6510000.i2c: probed
[    2.212397] pca953x 4-0020: 4-0020 supply vcc not found, using dummy regulator
[    2.220399] i2c-rcar e66d8000.i2c: probed
[    2.231022] rcar_gen3_thermal e6198000.thermal: TSC0: Loaded 1 trip points
[    2.242049] rcar_gen3_thermal e6198000.thermal: TSC1: Loaded 1 trip points
[    2.253051] rcar_gen3_thermal e6198000.thermal: TSC2: Loaded 2 trip points
[    2.262525] cpufreq: cpufreq_online: CPU0: Running at unlisted freq: 1499999 KHz
[    2.269954] cpufreq: cpufreq_online: CPU0: Unlisted initial frequency changed to: 1500000 KHz
[    2.278842] cpufreq: cpufreq_online: CPU4: Running at unlisted freq: 1199999 KHz
[    2.286537] cpufreq: cpufreq_online: CPU4: Unlisted initial frequency changed to: 1200000 KHz
[    2.295864] sdhci: Secure Digital Host Controller Interface driver
[    2.302048] sdhci: Copyright(c) Pierre Ossman
[    2.307021] renesas_sdhi_internal_dmac ee100000.sd: Got CD GPIO
[    2.312959] renesas_sdhi_internal_dmac ee100000.sd: Got WP GPIO
[    2.389858] renesas_sdhi_internal_dmac ee140000.sd: IRQ index 1 not found
[    2.396653] renesas_sdhi_internal_dmac ee140000.sd: mmc0 base at 0xee140000 max clock rate 200 MHz
[    2.405964] renesas_sdhi_internal_dmac ee160000.sd: Got CD GPIO
[    2.411904] renesas_sdhi_internal_dmac ee160000.sd: Got WP GPIO
[    2.418211] Synopsys Designware Multimedia Card Interface Driver
[    2.425178] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.432494] ledtrig-cpu: registered to indicate activity on CPUs
[    2.439571] usbcore: registered new interface driver usbhid
[    2.445144] usbhid: USB HID core driver
[    2.452453] NET: Registered protocol family 17
[    2.457011] 9pnet: Installing 9P2000 support
[    2.461319] Key type dns_resolver registered
[    2.465799] registered taskstats version 1
[    2.469898] Loading compiled-in X.509 certificates
[    2.482897] renesas_irqc e61c0000.interrupt-controller: driving 6 irqs
[    2.495600] bd9571mwv 7-0030: Device: BD9571MWV rev. 1
[    2.515031] mmc0: new HS400 MMC card at address 0001
[    2.520418] mmcblk0: mmc0:0001 BGSD3R 29.1 GiB 
[    2.525131] mmcblk0boot0: mmc0:0001 BGSD3R partition 1 16.0 MiB
[    2.529575] ehci-platform ee080100.usb: EHCI Host Controller
[    2.531207] mmcblk0boot1: mmc0:0001 BGSD3R partition 2 16.0 MiB
[    2.536718] ehci-platform ee080100.usb: new USB bus registered, assigned bus number 5
[    2.542734] mmcblk0rpmb: mmc0:0001 BGSD3R partition 3 4.00 MiB, chardev (237:0)
[    2.550499] ehci-platform ee080100.usb: irq 164, io mem 0xee080100
[    2.558357]  mmcblk0: p1
[    2.577560] ehci-platform ee080100.usb: USB 2.0 started, EHCI 1.10
[    2.584084] hub 5-0:1.0: USB hub found
[    2.587851] hub 5-0:1.0: 1 port detected
[    2.592849] ohci-platform ee080000.usb: Generic Platform OHCI controller
[    2.599569] ohci-platform ee080000.usb: new USB bus registered, assigned bus number 6
[    2.607446] ohci-platform ee080000.usb: irq 164, io mem 0xee080000
[    2.704528] hub 6-0:1.0: USB hub found
[    2.708295] hub 6-0:1.0: 1 port detected
[    2.713342] renesas_sdhi_internal_dmac ee100000.sd: Got CD GPIO
[    2.719283] renesas_sdhi_internal_dmac ee100000.sd: Got WP GPIO
[    2.795713] renesas_sdhi_internal_dmac ee100000.sd: IRQ index 1 not found
[    2.802509] renesas_sdhi_internal_dmac ee100000.sd: mmc1 base at 0xee100000 max clock rate 200 MHz
[    2.812389] renesas_sdhi_internal_dmac ee160000.sd: Got CD GPIO
[    2.818337] renesas_sdhi_internal_dmac ee160000.sd: Got WP GPIO
[    2.894683] renesas_sdhi_internal_dmac ee160000.sd: IRQ index 1 not found
[    2.901477] renesas_sdhi_internal_dmac ee160000.sd: mmc2 base at 0xee160000 max clock rate 200 MHz
[    2.914096] rcar-dmac e6700000.dma-controller: ignoring dependency for device, assuming no driver
[    2.925001] rcar-dmac e7300000.dma-controller: ignoring dependency for device, assuming no driver
[    2.935788] rcar-dmac e7310000.dma-controller: ignoring dependency for device, assuming no driver
[    2.946621] rcar-dmac ec700000.dma-controller: ignoring dependency for device, assuming no driver
[    2.957413] rcar-dmac ec720000.dma-controller: ignoring dependency for device, assuming no driver
[    2.968426] sata_rcar ee300000.sata: ignoring dependency for device, assuming no driver
[    2.976875] scsi host0: sata_rcar
[    2.980348] ata1: SATA max UDMA/133 irq 170
[    2.985299] ravb e6800000.ethernet: ignoring dependency for device, assuming no driver
[    2.993512] libphy: ravb_mii: probed
[    2.998278] ravb e6800000.ethernet eth0: Base address at 0xe6800000, 2e:09:0a:00:83:ea, IRQ 116.
[    3.008624] input: keys as /devices/platform/keys/input/input0
[    3.014713] hctosys: unable to open rtc device (rtc0)
[    3.096510] Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=e6800000.ethernet-ffffffff:00, irq=175)
[    3.401564] ata1: link resume succeeded after 1 retries
[    3.513072] ata1: SATA link down (SStatus 0 SControl 300)
[    4.742059] ravb e6800000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[    4.773553] Sending DHCP requests ..,
[    7.413975] random: fast init done
[    7.421550]  OK
[    7.423320] IP-Config: Got DHCP answer from 192.168.44.74, my address is 192.168.44.104
[    7.431336] IP-Config: Complete:
[    7.434568]      device=eth0, hwaddr=2e:09:0a:00:83:ea, ipaddr=192.168.44.104, mask=255.255.255.0, gw=192.168.44.74
[    7.445000]      host=192.168.44.104, domain=shimoda-i7.org, nis-domain=(none)
[    7.452218]      bootserver=192.168.44.74, rootserver=192.168.44.74, rootpath=/var/lib/tftpboot/aarch64/rootfs/buildroot
[    7.452220]      nameserver0=192.168.44.74
[    7.467553] SDHI0 Vcc: disabling
[    7.470782] SDHI3 Vcc: disabling
[    7.474008] SDHI0 VccQ: disabling
[    7.477316] SDHI3 VccQ: disabling
[    7.480632] ALSA device list:
[    7.483598]   No soundcards found.
[    7.492496] VFS: Mounted root (nfs filesystem) on device 0:19.
[    7.498742] devtmpfs: mounted
[    7.504263] Freeing unused kernel memory: 4992K
[    7.513642] Run /sbin/init as init process
[    7.843871] Unable to handle kernel paging request at virtual address 0000000056000000
[    7.851797] Mem abort info:
[    7.854589]   ESR = 0x96000004
[    7.857642]   EC = 0x25: DABT (current EL), IL = 32 bits
[    7.862950]   SET = 0, FnV = 0
[    7.866001]   EA = 0, S1PTW = 0
[    7.869134] Data abort info:
[    7.872011]   ISV = 0, ISS = 0x00000004
[    7.875842]   CM = 0, WnR = 0
[    7.878806] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000774787000
[    7.885242] [0000000056000000] pgd=0000000000000000
[    7.890119] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    7.895684] Modules linked in:
[    7.898737] CPU: 2 PID: 1 Comm: systemd Not tainted 5.3.0-rc6-next-20190902-00001-g9709468 #48
[    7.907340] Hardware name: Renesas Salvator-X board based on r8a7795 ES2.0+ (DT)
[    7.914729] pstate: 20000005 (nzCv daif -PAN -UAO)
[    7.919523] pc : dput+0x38/0x2e8
[    7.922743] lr : dput+0x34/0x2e8
[    7.925964] sp : ffff80001006bba0
[    7.929270] x29: ffff80001006bba0 x28: ffff000735c98000 
[    7.934576] x27: 0000000000000000 x26: 0000000000000000 
[    7.939881] x25: 0000000056000000 x24: 0000000000004000 
[    7.945186] x23: 0000000000000001 x22: 0000000000080060 
[    7.950491] x21: 0000000000080040 x20: 0000000056000058 
[    7.955795] x19: 0000000056000000 x18: 0000000000000000 
[    7.961099] x17: 0000000000000000 x16: 0000000000000000 
[    7.966403] x15: 0000000000000000 x14: 0000000000000000 
[    7.971707] x13: 0000000000000000 x12: fefefefefefefeff 
[    7.977011] x11: 0000ffffa01018b8 x10: 0000ffffa01018b8 
[    7.982315] x9 : 6bff3a3a375c19ff x8 : 00ffffa01018b800 
[    7.987620] x7 : 0000000000000000 x6 : 0000000000000000 
[    7.992924] x5 : 0000000000000064 x4 : 0000000c00000000 
[    7.998228] x3 : 0000000000000001 x2 : 0000000000000082 
[    8.003532] x1 : ffff000735c98000 x0 : 0000000000000001 
[    8.008838] Call trace:
[    8.011278]  dput+0x38/0x2e8
[    8.014155]  terminate_walk+0xf4/0x120
[    8.017897]  path_lookupat+0xf8/0x1f8
[    8.021553]  filename_lookup+0x8c/0x160
[    8.025382]  user_path_at_empty+0x48/0x58
[    8.029387]  __arm64_sys_name_to_handle_at+0x64/0x2d0
[    8.034435]  el0_svc_common+0x68/0x178
[    8.038177]  el0_svc_handler+0x24/0x98
[    8.041920]  el0_svc+0x8/0xc
[    8.044798] Code: 72a00115 52800037 97fb26b4 91016274 (b9400260) 
[    8.050895] ---[ end trace dd06490ec981282b ]---
[    8.055966] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    8.063619] SMP: stopping secondary CPUs
[    8.067539] Kernel Offset: disabled
[    8.071021] CPU features: 0x0002,21006004
[    8.075022] Memory Limit: none
[    8.078076] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Best regards,
Yoshihiro Shimoda


^ permalink raw reply

* Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
From: Michal Koutný @ 2019-09-03  8:52 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: Patrick Bellasi, Alessio Balsini, Dietmar Eggemann,
	Morten Rasmussen, Quentin Perret, Joel Fernandes, Paul Turner,
	Steve Muckle, Todd Kjos, Peter Zijlstra, Rafael J . Wysocki,
	Tejun Heo, Vincent Guittot, Viresh Kumar, Juri Lelli, Ingo Molnar,
	cgroups mailinglist, linux-api, LKML, linux-pm
In-Reply-To: <CAJuCfpGWtrg02LNE3PJZag9-LLVT=by2v+9x_tm1PyoXwZ8DqQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

On Mon, Sep 02, 2019 at 04:02:57PM -0700, Suren Baghdasaryan <surenb@google.com> wrote:
> > +static inline void cpu_uclamp_print(struct seq_file *sf,
> > +                                   enum uclamp_id clamp_id)
> > [...]
> > +       rcu_read_lock();
> > +       tg = css_tg(seq_css(sf));
> > +       util_clamp = tg->uclamp_req[clamp_id].value;
> > +       rcu_read_unlock();
> > +
> > +       if (util_clamp == SCHED_CAPACITY_SCALE) {
> > +               seq_puts(sf, "max\n");
> > +               return;
> > +       }
> > +
> > +       percent = tg->uclamp_pct[clamp_id];
> 
> You are taking RCU lock when accessing tg->uclamp_req but not when
> accessing tg->uclamp_pct.
Good point.

> Is that intentional? Can tg be destroyed under you?
Actually, the rcu_read{,un}lock should be unnecessary in the context of
the kernfs file op handler -- the tg/css won't go away as long as its
kernfs file is being worked with.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* RE: [PATCH 06/11] Add a general, global device notification watch list [ver #7]
From: Yoshihiro Shimoda @ 2019-09-03  8:34 UTC (permalink / raw)
  To: David Howells, viro@zeniv.linux.org.uk
  Cc: Casey Schaufler, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel@6wind.com, raven@themaw.net, Christian Brauner,
	keyrings@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-block@vger.kernel.org
In-Reply-To: <156717348608.2204.16592073177201775472.stgit@warthog.procyon.org.uk>

Hi,

> From: David Howells, Sent: Friday, August 30, 2019 10:58 PM
<snip>
> ---
> 
>  Documentation/watch_queue.rst               |   22 ++++++-
>  arch/alpha/kernel/syscalls/syscall.tbl      |    1
>  arch/arm/tools/syscall.tbl                  |    1
>  arch/ia64/kernel/syscalls/syscall.tbl       |    1

It seems to lack modification for arch/arm64.

I'm not sure whether this is related, but my environment (R-Car H3 / r8a7795)
cannot boot on next-20190902 which contains this patch. I found an issue
on the patch 08/11, so I'll report on the email thread later.

>  arch/m68k/kernel/syscalls/syscall.tbl       |    1
>  arch/microblaze/kernel/syscalls/syscall.tbl |    1
>  arch/mips/kernel/syscalls/syscall_n32.tbl   |    1
>  arch/mips/kernel/syscalls/syscall_n64.tbl   |    1
>  arch/mips/kernel/syscalls/syscall_o32.tbl   |    1
>  arch/parisc/kernel/syscalls/syscall.tbl     |    1
>  arch/powerpc/kernel/syscalls/syscall.tbl    |    1
>  arch/s390/kernel/syscalls/syscall.tbl       |    1
>  arch/sh/kernel/syscalls/syscall.tbl         |    1
>  arch/sparc/kernel/syscalls/syscall.tbl      |    1
>  arch/x86/entry/syscalls/syscall_32.tbl      |    1
>  arch/x86/entry/syscalls/syscall_64.tbl      |    1
>  arch/xtensa/kernel/syscalls/syscall.tbl     |    1
>  drivers/base/Kconfig                        |    9 +++
>  drivers/base/Makefile                       |    1
>  drivers/base/watch.c                        |   90 +++++++++++++++++++++++++++
>  include/linux/device.h                      |    7 ++
>  include/linux/syscalls.h                    |    1
>  include/uapi/asm-generic/unistd.h           |    4 +
>  kernel/sys_ni.c                             |    1
>  24 files changed, 149 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/base/watch.c

Best regards,
Yoshihiro Shimoda


^ permalink raw reply

* Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
From: Suren Baghdasaryan @ 2019-09-02 23:02 UTC (permalink / raw)
  To: Patrick Bellasi
  Cc: LKML, linux-pm, linux-api, cgroups mailinglist, Ingo Molnar,
	Peter Zijlstra, Tejun Heo, Rafael J . Wysocki, Vincent Guittot,
	Viresh Kumar, Paul Turner, Michal Koutny, Quentin Perret,
	Dietmar Eggemann, Morten Rasmussen, Juri Lelli, Todd Kjos,
	Joel Fernandes, Steve Muckle, Alessio Balsini
In-Reply-To: <20190822132811.31294-2-patrick.bellasi@arm.com>

Hi Patrick,

On Thu, Aug 22, 2019 at 6:28 AM Patrick Bellasi <patrick.bellasi@arm.com> wrote:
>
> The cgroup CPU bandwidth controller allows to assign a specified
> (maximum) bandwidth to the tasks of a group. However this bandwidth is
> defined and enforced only on a temporal base, without considering the
> actual frequency a CPU is running on. Thus, the amount of computation
> completed by a task within an allocated bandwidth can be very different
> depending on the actual frequency the CPU is running that task.
> The amount of computation can be affected also by the specific CPU a
> task is running on, especially when running on asymmetric capacity
> systems like Arm's big.LITTLE.
>
> With the availability of schedutil, the scheduler is now able
> to drive frequency selections based on actual task utilization.
> Moreover, the utilization clamping support provides a mechanism to
> bias the frequency selection operated by schedutil depending on
> constraints assigned to the tasks currently RUNNABLE on a CPU.
>
> Giving the mechanisms described above, it is now possible to extend the
> cpu controller to specify the minimum (or maximum) utilization which
> should be considered for tasks RUNNABLE on a cpu.
> This makes it possible to better defined the actual computational
> power assigned to task groups, thus improving the cgroup CPU bandwidth
> controller which is currently based just on time constraints.
>
> Extend the CPU controller with a couple of new attributes uclamp.{min,max}
> which allow to enforce utilization boosting and capping for all the
> tasks in a group.
>
> Specifically:
>
> - uclamp.min: defines the minimum utilization which should be considered
>               i.e. the RUNNABLE tasks of this group will run at least at a
>                  minimum frequency which corresponds to the uclamp.min
>                  utilization
>
> - uclamp.max: defines the maximum utilization which should be considered
>               i.e. the RUNNABLE tasks of this group will run up to a
>                  maximum frequency which corresponds to the uclamp.max
>                  utilization
>
> These attributes:
>
> a) are available only for non-root nodes, both on default and legacy
>    hierarchies, while system wide clamps are defined by a generic
>    interface which does not depends on cgroups. This system wide
>    interface enforces constraints on tasks in the root node.
>
> b) enforce effective constraints at each level of the hierarchy which
>    are a restriction of the group requests considering its parent's
>    effective constraints. Root group effective constraints are defined
>    by the system wide interface.
>    This mechanism allows each (non-root) level of the hierarchy to:
>    - request whatever clamp values it would like to get
>    - effectively get only up to the maximum amount allowed by its parent
>
> c) have higher priority than task-specific clamps, defined via
>    sched_setattr(), thus allowing to control and restrict task requests.
>
> Add two new attributes to the cpu controller to collect "requested"
> clamp values. Allow that at each non-root level of the hierarchy.
> Keep it simple by not caring now about "effective" values computation
> and propagation along the hierarchy.
>
> Update sysctl_sched_uclamp_handler() to use the newly introduced
> uclamp_mutex so that we serialize system default updates with cgroup
> relate updates.
>
> Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
> Reviewed-by: Michal Koutny <mkoutny@suse.com>
> Acked-by: Tejun Heo <tj@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Tejun Heo <tj@kernel.org>
>
> ---
> Changes in v14:
>  Message-ID: <20190806161133.GA18532@blackbody.suse.cz>
>  - move uclamp_mutex usage here from the following patch
> ---
>  Documentation/admin-guide/cgroup-v2.rst |  34 +++++
>  init/Kconfig                            |  22 +++
>  kernel/sched/core.c                     | 188 +++++++++++++++++++++++-
>  kernel/sched/sched.h                    |   8 +
>  4 files changed, 248 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
> index 3b29005aa981..5f1c266131b0 100644
> --- a/Documentation/admin-guide/cgroup-v2.rst
> +++ b/Documentation/admin-guide/cgroup-v2.rst
> @@ -951,6 +951,13 @@ controller implements weight and absolute bandwidth limit models for
>  normal scheduling policy and absolute bandwidth allocation model for
>  realtime scheduling policy.
>
> +In all the above models, cycles distribution is defined only on a temporal
> +base and it does not account for the frequency at which tasks are executed.
> +The (optional) utilization clamping support allows to hint the schedutil
> +cpufreq governor about the minimum desired frequency which should always be
> +provided by a CPU, as well as the maximum desired frequency, which should not
> +be exceeded by a CPU.
> +
>  WARNING: cgroup2 doesn't yet support control of realtime processes and
>  the cpu controller can only be enabled when all RT processes are in
>  the root cgroup.  Be aware that system management software may already
> @@ -1016,6 +1023,33 @@ All time durations are in microseconds.
>         Shows pressure stall information for CPU. See
>         Documentation/accounting/psi.rst for details.
>
> +  cpu.uclamp.min
> +        A read-write single value file which exists on non-root cgroups.
> +        The default is "0", i.e. no utilization boosting.
> +
> +        The requested minimum utilization (protection) as a percentage
> +        rational number, e.g. 12.34 for 12.34%.
> +
> +        This interface allows reading and setting minimum utilization clamp
> +        values similar to the sched_setattr(2). This minimum utilization
> +        value is used to clamp the task specific minimum utilization clamp.
> +
> +        The requested minimum utilization (protection) is always capped by
> +        the current value for the maximum utilization (limit), i.e.
> +        `cpu.uclamp.max`.
> +
> +  cpu.uclamp.max
> +        A read-write single value file which exists on non-root cgroups.
> +        The default is "max". i.e. no utilization capping
> +
> +        The requested maximum utilization (limit) as a percentage rational
> +        number, e.g. 98.76 for 98.76%.
> +
> +        This interface allows reading and setting maximum utilization clamp
> +        values similar to the sched_setattr(2). This maximum utilization
> +        value is used to clamp the task specific maximum utilization clamp.
> +
> +
>
>  Memory
>  ------
> diff --git a/init/Kconfig b/init/Kconfig
> index bd7d650d4a99..ac285cfa78b6 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -928,6 +928,28 @@ config RT_GROUP_SCHED
>
>  endif #CGROUP_SCHED
>
> +config UCLAMP_TASK_GROUP
> +       bool "Utilization clamping per group of tasks"
> +       depends on CGROUP_SCHED
> +       depends on UCLAMP_TASK
> +       default n
> +       help
> +         This feature enables the scheduler to track the clamped utilization
> +         of each CPU based on RUNNABLE tasks currently scheduled on that CPU.
> +
> +         When this option is enabled, the user can specify a min and max
> +         CPU bandwidth which is allowed for each single task in a group.
> +         The max bandwidth allows to clamp the maximum frequency a task
> +         can use, while the min bandwidth allows to define a minimum
> +         frequency a task will always use.
> +
> +         When task group based utilization clamping is enabled, an eventually
> +         specified task-specific clamp value is constrained by the cgroup
> +         specified clamp value. Both minimum and maximum task clamping cannot
> +         be bigger than the corresponding clamping defined at task group level.
> +
> +         If in doubt, say N.
> +
>  config CGROUP_PIDS
>         bool "PIDs controller"
>         help
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a6661852907b..7b610e1a4cda 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -773,6 +773,18 @@ static void set_load_weight(struct task_struct *p, bool update_load)
>  }
>
>  #ifdef CONFIG_UCLAMP_TASK
> +/*
> + * Serializes updates of utilization clamp values
> + *
> + * The (slow-path) user-space triggers utilization clamp value updates which
> + * can require updates on (fast-path) scheduler's data structures used to
> + * support enqueue/dequeue operations.
> + * While the per-CPU rq lock protects fast-path update operations, user-space
> + * requests are serialized using a mutex to reduce the risk of conflicting
> + * updates or API abuses.
> + */
> +static DEFINE_MUTEX(uclamp_mutex);
> +
>  /* Max allowed minimum utilization */
>  unsigned int sysctl_sched_uclamp_util_min = SCHED_CAPACITY_SCALE;
>
> @@ -1010,10 +1022,9 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
>                                 loff_t *ppos)
>  {
>         int old_min, old_max;
> -       static DEFINE_MUTEX(mutex);
>         int result;
>
> -       mutex_lock(&mutex);
> +       mutex_lock(&uclamp_mutex);
>         old_min = sysctl_sched_uclamp_util_min;
>         old_max = sysctl_sched_uclamp_util_max;
>
> @@ -1048,7 +1059,7 @@ int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
>         sysctl_sched_uclamp_util_min = old_min;
>         sysctl_sched_uclamp_util_max = old_max;
>  done:
> -       mutex_unlock(&mutex);
> +       mutex_unlock(&uclamp_mutex);
>
>         return result;
>  }
> @@ -1137,6 +1148,8 @@ static void __init init_uclamp(void)
>         unsigned int clamp_id;
>         int cpu;
>
> +       mutex_init(&uclamp_mutex);
> +
>         for_each_possible_cpu(cpu) {
>                 memset(&cpu_rq(cpu)->uclamp, 0, sizeof(struct uclamp_rq));
>                 cpu_rq(cpu)->uclamp_flags = 0;
> @@ -1149,8 +1162,12 @@ static void __init init_uclamp(void)
>
>         /* System defaults allow max clamp values for both indexes */
>         uclamp_se_set(&uc_max, uclamp_none(UCLAMP_MAX), false);
> -       for_each_clamp_id(clamp_id)
> +       for_each_clamp_id(clamp_id) {
>                 uclamp_default[clamp_id] = uc_max;
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +               root_task_group.uclamp_req[clamp_id] = uc_max;
> +#endif
> +       }
>  }
>
>  #else /* CONFIG_UCLAMP_TASK */
> @@ -6798,6 +6815,19 @@ void ia64_set_curr_task(int cpu, struct task_struct *p)
>  /* task_group_lock serializes the addition/removal of task groups */
>  static DEFINE_SPINLOCK(task_group_lock);
>
> +static inline void alloc_uclamp_sched_group(struct task_group *tg,
> +                                           struct task_group *parent)
> +{
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +       int clamp_id;
> +
> +       for_each_clamp_id(clamp_id) {
> +               uclamp_se_set(&tg->uclamp_req[clamp_id],
> +                             uclamp_none(clamp_id), false);
> +       }
> +#endif
> +}
> +
>  static void sched_free_group(struct task_group *tg)
>  {
>         free_fair_sched_group(tg);
> @@ -6821,6 +6851,8 @@ struct task_group *sched_create_group(struct task_group *parent)
>         if (!alloc_rt_sched_group(tg, parent))
>                 goto err;
>
> +       alloc_uclamp_sched_group(tg, parent);
> +
>         return tg;
>
>  err:
> @@ -7037,6 +7069,126 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset)
>                 sched_move_task(task);
>  }
>
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +
> +#define _POW10(exp) ((unsigned int)1e##exp)
> +#define POW10(exp) _POW10(exp)
> +
> +struct uclamp_request {
> +#define UCLAMP_PERCENT_SHIFT   2
> +#define UCLAMP_PERCENT_SCALE   (100 * POW10(UCLAMP_PERCENT_SHIFT))
> +       s64 percent;
> +       u64 util;
> +       int ret;
> +};
> +
> +static inline struct uclamp_request
> +capacity_from_percent(char *buf)
> +{
> +       struct uclamp_request req = {
> +               .percent = UCLAMP_PERCENT_SCALE,
> +               .util = SCHED_CAPACITY_SCALE,
> +               .ret = 0,
> +       };
> +
> +       buf = strim(buf);
> +       if (strncmp("max", buf, 4)) {
> +               req.ret = cgroup_parse_float(buf, UCLAMP_PERCENT_SHIFT,
> +                                            &req.percent);
> +               if (req.ret)
> +                       return req;
> +               if (req.percent > UCLAMP_PERCENT_SCALE) {
> +                       req.ret = -ERANGE;
> +                       return req;
> +               }
> +
> +               req.util = req.percent << SCHED_CAPACITY_SHIFT;
> +               req.util = DIV_ROUND_CLOSEST_ULL(req.util, UCLAMP_PERCENT_SCALE);
> +       }
> +
> +       return req;
> +}
> +
> +static ssize_t cpu_uclamp_write(struct kernfs_open_file *of, char *buf,
> +                               size_t nbytes, loff_t off,
> +                               enum uclamp_id clamp_id)
> +{
> +       struct uclamp_request req;
> +       struct task_group *tg;
> +
> +       req = capacity_from_percent(buf);
> +       if (req.ret)
> +               return req.ret;
> +
> +       mutex_lock(&uclamp_mutex);
> +       rcu_read_lock();
> +
> +       tg = css_tg(of_css(of));
> +       if (tg->uclamp_req[clamp_id].value != req.util)
> +               uclamp_se_set(&tg->uclamp_req[clamp_id], req.util, false);
> +
> +       /*
> +        * Because of not recoverable conversion rounding we keep track of the
> +        * exact requested value
> +        */
> +       tg->uclamp_pct[clamp_id] = req.percent;
> +
> +       rcu_read_unlock();
> +       mutex_unlock(&uclamp_mutex);
> +
> +       return nbytes;
> +}
> +
> +static ssize_t cpu_uclamp_min_write(struct kernfs_open_file *of,
> +                                   char *buf, size_t nbytes,
> +                                   loff_t off)
> +{
> +       return cpu_uclamp_write(of, buf, nbytes, off, UCLAMP_MIN);
> +}
> +
> +static ssize_t cpu_uclamp_max_write(struct kernfs_open_file *of,
> +                                   char *buf, size_t nbytes,
> +                                   loff_t off)
> +{
> +       return cpu_uclamp_write(of, buf, nbytes, off, UCLAMP_MAX);
> +}
> +
> +static inline void cpu_uclamp_print(struct seq_file *sf,
> +                                   enum uclamp_id clamp_id)
> +{
> +       struct task_group *tg;
> +       u64 util_clamp;
> +       u64 percent;
> +       u32 rem;
> +
> +       rcu_read_lock();
> +       tg = css_tg(seq_css(sf));
> +       util_clamp = tg->uclamp_req[clamp_id].value;
> +       rcu_read_unlock();
> +
> +       if (util_clamp == SCHED_CAPACITY_SCALE) {
> +               seq_puts(sf, "max\n");
> +               return;
> +       }
> +
> +       percent = tg->uclamp_pct[clamp_id];

You are taking RCU lock when accessing tg->uclamp_req but not when
accessing tg->uclamp_pct. Is that intentional? Can tg be destroyed
under you?

> +       percent = div_u64_rem(percent, POW10(UCLAMP_PERCENT_SHIFT), &rem);
> +       seq_printf(sf, "%llu.%0*u\n", percent, UCLAMP_PERCENT_SHIFT, rem);
> +}
> +
> +static int cpu_uclamp_min_show(struct seq_file *sf, void *v)
> +{
> +       cpu_uclamp_print(sf, UCLAMP_MIN);
> +       return 0;
> +}
> +
> +static int cpu_uclamp_max_show(struct seq_file *sf, void *v)
> +{
> +       cpu_uclamp_print(sf, UCLAMP_MAX);
> +       return 0;
> +}
> +#endif /* CONFIG_UCLAMP_TASK_GROUP */
> +
>  #ifdef CONFIG_FAIR_GROUP_SCHED
>  static int cpu_shares_write_u64(struct cgroup_subsys_state *css,
>                                 struct cftype *cftype, u64 shareval)
> @@ -7381,6 +7533,20 @@ static struct cftype cpu_legacy_files[] = {
>                 .read_u64 = cpu_rt_period_read_uint,
>                 .write_u64 = cpu_rt_period_write_uint,
>         },
> +#endif
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +       {
> +               .name = "uclamp.min",
> +               .flags = CFTYPE_NOT_ON_ROOT,
> +               .seq_show = cpu_uclamp_min_show,
> +               .write = cpu_uclamp_min_write,
> +       },
> +       {
> +               .name = "uclamp.max",
> +               .flags = CFTYPE_NOT_ON_ROOT,
> +               .seq_show = cpu_uclamp_max_show,
> +               .write = cpu_uclamp_max_write,
> +       },
>  #endif
>         { }     /* Terminate */
>  };
> @@ -7548,6 +7714,20 @@ static struct cftype cpu_files[] = {
>                 .seq_show = cpu_max_show,
>                 .write = cpu_max_write,
>         },
> +#endif
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +       {
> +               .name = "uclamp.min",
> +               .flags = CFTYPE_NOT_ON_ROOT,
> +               .seq_show = cpu_uclamp_min_show,
> +               .write = cpu_uclamp_min_write,
> +       },
> +       {
> +               .name = "uclamp.max",
> +               .flags = CFTYPE_NOT_ON_ROOT,
> +               .seq_show = cpu_uclamp_max_show,
> +               .write = cpu_uclamp_max_write,
> +       },
>  #endif
>         { }     /* terminate */
>  };
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 7111e3a1eeb4..ae1be61fb279 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -391,6 +391,14 @@ struct task_group {
>  #endif
>
>         struct cfs_bandwidth    cfs_bandwidth;
> +
> +#ifdef CONFIG_UCLAMP_TASK_GROUP
> +       /* The two decimal precision [%] value requested from user-space */
> +       unsigned int            uclamp_pct[UCLAMP_CNT];
> +       /* Clamp values requested for a task group */
> +       struct uclamp_se        uclamp_req[UCLAMP_CNT];
> +#endif
> +
>  };
>
>  #ifdef CONFIG_FAIR_GROUP_SCHED
> --
> 2.22.0
>

^ permalink raw reply

* Re: [PATCH 00/11] Keyrings, Block and USB notifications [ver #7]
From: David Howells @ 2019-09-02 13:26 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, viro, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <563ae8b4-753a-179d-4f6d-94d2dd058f3b@schaufler-ca.com>

Casey Schaufler <casey@schaufler-ca.com> wrote:

> > Tests for the key/keyring events can be found on the keyutils next branch:
> >
> > 	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/log/?h=next
> 
> I'm having trouble with the "make install" on Fedora. Is there an
> unusual dependency?

I've pushed a couple of patches to my next branch.  Do "make install" and
"make rpm" now work for you?

David

^ permalink raw reply

* Re: [PATCH 00/11] Keyrings, Block and USB notifications [ver #7]
From: David Howells @ 2019-09-02 12:39 UTC (permalink / raw)
  To: Casey Schaufler
  Cc: dhowells, viro, Stephen Smalley, Greg Kroah-Hartman,
	nicolas.dichtel, raven, Christian Brauner, keyrings, linux-usb,
	linux-security-module, linux-fsdevel, linux-api, linux-block,
	linux-kernel
In-Reply-To: <563ae8b4-753a-179d-4f6d-94d2dd058f3b@schaufler-ca.com>

Casey Schaufler <casey@schaufler-ca.com> wrote:

> > Tests for the key/keyring events can be found on the keyutils next branch:
> >
> > 	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/keyutils.git/log/?h=next
> 
> I'm having trouble with the "make install" on Fedora. Is there an
> unusual dependency?

What's the symptom you're seeing?  Is it this:

install -D -m 0644 libkeyutils.a /tmp/opt/lib64 libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007f7dcbf6d000)/libkeyutils.a
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `install -D -m 0644 libkeyutils.a /tmp/opt/lib64 libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007f7dcbf6d000)/libkeyutils.a'

David

^ permalink raw reply

* Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
From: Peter Zijlstra @ 2019-09-02  7:47 UTC (permalink / raw)
  To: Patrick Bellasi
  Cc: linux-kernel, linux-pm, linux-api, cgroups, Ingo Molnar,
	Tejun Heo, Rafael J . Wysocki, Vincent Guittot, Viresh Kumar,
	Paul Turner, Michal Koutny, Quentin Perret, Dietmar Eggemann,
	Morten Rasmussen, Juri Lelli, Todd Kjos, Joel Fernandes,
	Steve Muckle, Suren Baghdasaryan, Alessio Balsini
In-Reply-To: <87zhjnnqz2.fsf@arm.com>

On Mon, Sep 02, 2019 at 07:38:53AM +0100, Patrick Bellasi wrote:
> 
> On Fri, Aug 30, 2019 at 09:45:05 +0000, Peter Zijlstra wrote...
> 
> > On Thu, Aug 22, 2019 at 02:28:06PM +0100, Patrick Bellasi wrote:
> >> +#define _POW10(exp) ((unsigned int)1e##exp)
> >> +#define POW10(exp) _POW10(exp)
> >
> > What is this magic? You're forcing a float literal into an integer.
> > Surely that deserves a comment!
> 
> Yes, I'm introducing the two constants:
>   UCLAMP_PERCENT_SHIFT,
>   UCLAMP_PERCENT_SCALE
> similar to what we have for CAPACITY. Moreover, I need both 100*100 (for
> the scale) and 100 further down in the code for the: 

Ooh, right you are. I clearly was in need of weekend. Somehow I read
that code as if you were forcing the float representation into an
integer, which is not what you do.

> 	percent = div_u64_rem(percent, POW10(UCLAMP_PERCENT_SHIFT), &rem);
> 
> used in cpu_uclamp_print().
> 
> That's why adding a compile time support to compute a 10^N is useful.
> 
> C provides the "1eN" literal, I just convert it to integer and to do
> that at compile time I need a two level macros.
> 
> What if I add this comment just above the macro definitions:
> 
> /*
>  * Integer 10^N with a given N exponent by casting to integer the literal "1eN"
>  * C expression. Since there is no way to convert a macro argument (N) into a
>  * character constant, use two levels of macros.
>  */
> 
> is this clear enough?

Yeah, let me go add that.

> >
> >> +struct uclamp_request {
> >> +#define UCLAMP_PERCENT_SHIFT	2
> >> +#define UCLAMP_PERCENT_SCALE	(100 * POW10(UCLAMP_PERCENT_SHIFT))
> >> +	s64 percent;
> >> +	u64 util;
> >> +	int ret;
> >> +};
> >> +
> >> +static inline struct uclamp_request
> >> +capacity_from_percent(char *buf)
> >> +{
> >> +	struct uclamp_request req = {
> >> +		.percent = UCLAMP_PERCENT_SCALE,
> >> +		.util = SCHED_CAPACITY_SCALE,
> >> +		.ret = 0,
> >> +	};
> >> +
> >> +	buf = strim(buf);
> >> +	if (strncmp("max", buf, 4)) {
> >
> > That is either a bug, and you meant to write: strncmp(buf, "max", 3),
> > or it is not, and then you could've written: strcmp(buf, "max")
> 
> I don't think it's a bug.
> 
> The usage of 4 is intentional, to force a '\0' check while using
> strncmp(). Otherwise, strncmp(buf, "max", 3) would accept also strings
> starting by "max", which we don't want.

Right; I figured.

> > But as written it doesn't make sense.
> 
> The code is safe but I agree that strcmp() does just the same and it
> does not generate confusion. That's actually a pretty good example
> on how it's not always better to use strncmp() instead of strcmp().

OK, I made it strcmp(), because that is what I figured was the intended
semantics.

^ permalink raw reply

* Re: [PATCH v14 5/6] sched/core: uclamp: Update CPU's refcount on TG's clamp changes
From: Peter Zijlstra @ 2019-09-02  7:38 UTC (permalink / raw)
  To: Patrick Bellasi
  Cc: linux-kernel, linux-pm, linux-api, cgroups, Ingo Molnar,
	Tejun Heo, Rafael J . Wysocki, Vincent Guittot, Viresh Kumar,
	Paul Turner, Michal Koutny, Quentin Perret, Dietmar Eggemann,
	Morten Rasmussen, Juri Lelli, Todd Kjos, Joel Fernandes,
	Steve Muckle, Suren Baghdasaryan, Alessio Balsini
In-Reply-To: <87woernqnb.fsf@arm.com>

On Mon, Sep 02, 2019 at 07:44:40AM +0100, Patrick Bellasi wrote:
> On Fri, Aug 30, 2019 at 09:48:34 +0000, Peter Zijlstra wrote...
> > On Thu, Aug 22, 2019 at 02:28:10PM +0100, Patrick Bellasi wrote:

> >> +	rq = task_rq_lock(p, &rf);
> >
> > Since modifying cgroup parameters is priv only, this should be OK I
> > suppose. Priv can already DoS the system anyway.
> 
> Are you referring to the possibility to DoS the scheduler by keep
> writing cgroup attributes?

Yep.

> Because, in that case I think cgroup attributes could be written also by
> non priv users. It all depends on how they are mounted and permissions
> are set. Isn't it?
> 
> Anyway, I'm not sure we can fix that here... and in principle we could
> have that DoS by setting CPUs affinities, which is user exposed.
> Isn't it?

Only for a single task; by using the cgroup thing we have that in-kernel
iteration of tasks.

The thing I worry about is bouncing rq->lock around the system; but
yeah, I suppose a normal user could achieve something similar with
enough tasks.

> >> +	/*
> >> +	 * Setting the clamp bucket is serialized by task_rq_lock().
> >> +	 * If the task is not yet RUNNABLE and its task_struct is not
> >> +	 * affecting a valid clamp bucket, the next time it's enqueued,
> >> +	 * it will already see the updated clamp bucket value.
> >> +	 */
> >> +	if (!p->uclamp[clamp_id].active)
> >> +		goto done;
> >> +
> >> +	uclamp_rq_dec_id(rq, p, clamp_id);
> >> +	uclamp_rq_inc_id(rq, p, clamp_id);
> >> +
> >> +done:
> >
> > I'm thinking that:
> >
> > 	if (p->uclamp[clamp_id].active) {
> > 		uclamp_rq_dec_id(rq, p, clamp_id);
> > 		uclamp_rq_inc_id(rq, p, clamp_id);
> > 	}
> >
> > was too obvious? ;-)
> 
> Yep, right... I think there was some more code in prev versions but I
> forgot to get rid of that "goto" pattern after some change.

OK, already fixed that.

^ permalink raw reply

* Re: [PATCH v14 5/6] sched/core: uclamp: Update CPU's refcount on TG's clamp changes
From: Patrick Bellasi @ 2019-09-02  6:44 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-pm, linux-api, cgroups, Ingo Molnar,
	Tejun Heo, Rafael J . Wysocki, Vincent Guittot, Viresh Kumar,
	Paul Turner, Michal Koutny, Quentin Perret, Dietmar Eggemann,
	Morten Rasmussen, Juri Lelli, Todd Kjos, Joel Fernandes,
	Steve Muckle, Suren Baghdasaryan, Alessio Balsini
In-Reply-To: <20190830094834.GB2369@hirez.programming.kicks-ass.net>


On Fri, Aug 30, 2019 at 09:48:34 +0000, Peter Zijlstra wrote...

> On Thu, Aug 22, 2019 at 02:28:10PM +0100, Patrick Bellasi wrote:
>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 04fc161e4dbe..fc2dc86a2abe 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -1043,6 +1043,57 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p)
>>  		uclamp_rq_dec_id(rq, p, clamp_id);
>>  }
>>  
>> +static inline void
>> +uclamp_update_active(struct task_struct *p, unsigned int clamp_id)
>> +{
>> +	struct rq_flags rf;
>> +	struct rq *rq;
>> +
>> +	/*
>> +	 * Lock the task and the rq where the task is (or was) queued.
>> +	 *
>> +	 * We might lock the (previous) rq of a !RUNNABLE task, but that's the
>> +	 * price to pay to safely serialize util_{min,max} updates with
>> +	 * enqueues, dequeues and migration operations.
>> +	 * This is the same locking schema used by __set_cpus_allowed_ptr().
>> +	 */
>> +	rq = task_rq_lock(p, &rf);
>
> Since modifying cgroup parameters is priv only, this should be OK I
> suppose. Priv can already DoS the system anyway.

Are you referring to the possibility to DoS the scheduler by keep
writing cgroup attributes?

Because, in that case I think cgroup attributes could be written also by
non priv users. It all depends on how they are mounted and permissions
are set. Isn't it?

Anyway, I'm not sure we can fix that here... and in principle we could
have that DoS by setting CPUs affinities, which is user exposed.
Isn't it?

>> +	/*
>> +	 * Setting the clamp bucket is serialized by task_rq_lock().
>> +	 * If the task is not yet RUNNABLE and its task_struct is not
>> +	 * affecting a valid clamp bucket, the next time it's enqueued,
>> +	 * it will already see the updated clamp bucket value.
>> +	 */
>> +	if (!p->uclamp[clamp_id].active)
>> +		goto done;
>> +
>> +	uclamp_rq_dec_id(rq, p, clamp_id);
>> +	uclamp_rq_inc_id(rq, p, clamp_id);
>> +
>> +done:
>
> I'm thinking that:
>
> 	if (p->uclamp[clamp_id].active) {
> 		uclamp_rq_dec_id(rq, p, clamp_id);
> 		uclamp_rq_inc_id(rq, p, clamp_id);
> 	}
>
> was too obvious? ;-)

Yep, right... I think there was some more code in prev versions but I
forgot to get rid of that "goto" pattern after some change.

>> +
>> +	task_rq_unlock(rq, p, &rf);
>> +}

Cheers,
Patrick

^ permalink raw reply

* Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller
From: Patrick Bellasi @ 2019-09-02  6:38 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-pm, linux-api, cgroups, Ingo Molnar,
	Tejun Heo, Rafael J . Wysocki, Vincent Guittot, Viresh Kumar,
	Paul Turner, Michal Koutny, Quentin Perret, Dietmar Eggemann,
	Morten Rasmussen, Juri Lelli, Todd Kjos, Joel Fernandes,
	Steve Muckle, Suren Baghdasaryan, Alessio Balsini
In-Reply-To: <20190830094505.GA2369@hirez.programming.kicks-ass.net>


On Fri, Aug 30, 2019 at 09:45:05 +0000, Peter Zijlstra wrote...

> On Thu, Aug 22, 2019 at 02:28:06PM +0100, Patrick Bellasi wrote:
>> +#define _POW10(exp) ((unsigned int)1e##exp)
>> +#define POW10(exp) _POW10(exp)
>
> What is this magic? You're forcing a float literal into an integer.
> Surely that deserves a comment!

Yes, I'm introducing the two constants:
  UCLAMP_PERCENT_SHIFT,
  UCLAMP_PERCENT_SCALE
similar to what we have for CAPACITY. Moreover, I need both 100*100 (for
the scale) and 100 further down in the code for the: 

	percent = div_u64_rem(percent, POW10(UCLAMP_PERCENT_SHIFT), &rem);

used in cpu_uclamp_print().

That's why adding a compile time support to compute a 10^N is useful.

C provides the "1eN" literal, I just convert it to integer and to do
that at compile time I need a two level macros.

What if I add this comment just above the macro definitions:

/*
 * Integer 10^N with a given N exponent by casting to integer the literal "1eN"
 * C expression. Since there is no way to convert a macro argument (N) into a
 * character constant, use two levels of macros.
 */

is this clear enough?

>
>> +struct uclamp_request {
>> +#define UCLAMP_PERCENT_SHIFT	2
>> +#define UCLAMP_PERCENT_SCALE	(100 * POW10(UCLAMP_PERCENT_SHIFT))
>> +	s64 percent;
>> +	u64 util;
>> +	int ret;
>> +};
>> +
>> +static inline struct uclamp_request
>> +capacity_from_percent(char *buf)
>> +{
>> +	struct uclamp_request req = {
>> +		.percent = UCLAMP_PERCENT_SCALE,
>> +		.util = SCHED_CAPACITY_SCALE,
>> +		.ret = 0,
>> +	};
>> +
>> +	buf = strim(buf);
>> +	if (strncmp("max", buf, 4)) {
>
> That is either a bug, and you meant to write: strncmp(buf, "max", 3),
> or it is not, and then you could've written: strcmp(buf, "max")

I don't think it's a bug.

The usage of 4 is intentional, to force a '\0' check while using
strncmp(). Otherwise, strncmp(buf, "max", 3) would accept also strings
starting by "max", which we don't want.

> But as written it doesn't make sense.

The code is safe but I agree that strcmp() does just the same and it
does not generate confusion. That's actually a pretty good example
on how it's not always better to use strncmp() instead of strcmp().

Cheers,
Patrick

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox