mei: use kvmalloc for read buffer
Subsystems (2)
Alexander Usyskin
maintainerRead buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.
--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/client.c +2 -2
@@ -321,7 +321,7 @@ void mei_io_cb_free(struct mei_cl_cb *cb)return ;list_del (&cb->list); -kfree (cb->buf.data); +kvfree (cb->buf.data);kfree (cb->ext_hdr);kfree (cb); }
@@ -497,7 +497,7 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,if (length ==0 )return cb; - cb->buf.data =kmalloc (roundup (length,MEI_SLOT_SIZE ),GFP_KERNEL ); + cb->buf.data =kvmalloc (roundup (length,MEI_SLOT_SIZE ),GFP_KERNEL );if (!cb->buf.data) {mei_io_cb_free (cb);return NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 9 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.
Quoted 4 lines
Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
What about this thread:
https://lore.kernel.org/all/[email protected]/
No attribution for the reporter? Does it solve their problem?
And why such a short line-length in the changelog?
Also, where is this memory pressure coming from, what is the root cause and what commit does this fix? Stable backports needed? Anything else?
And who inside Intel reviewed this before sending this out? Why are they not credited here properly?
thanks,
greg k-h
Usyskin, Alexander
maintainerQuoted 23 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 9 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Quoted 4 lines
Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS. Their symptoms are not the same as in the thread above.
But, as you rightly point out, this patch should also fix above problem. I'll add attribution in v2.
Quoted 1 line
And why such a short line-length in the changelog?
I've tried to split logically with not passing 75 characters. Will try to re-shuffle in v2.
Quoted 4 lines
Also, where is this memory pressure coming from, what is the root cause and what commit does this fix? Stable backports needed? Anything else?
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
I do not think that this patch fixes any commit - the problematic code exists from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch.
From your experience, is this the right strategy?
Quoted 3 lines
And who inside Intel reviewed this before sending this out? Why are they not credited here properly?
My bad, lost the tested-by tag in patch preparations. Will add in v2.
Quoted 3 lines
thanks,
greg k-h
- -
Thanks,
Sasha
Greg Kroah-Hartman
maintainerQuoted 23 lines · Alexander
Quoted 23 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 13 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 6 lines
What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Quoted 5 lines
Quoted 3 lines
Also, where is this memory pressure coming from, what is the root cause and what commit does this fix? Stable backports needed? Anything else?
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
Quoted 5 lines
I do not think that this patch fixes any commit - the problematic code exists from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch.
From your experience, is this the right strategy?
No.
Usyskin, Alexander
maintainerQuoted 8 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 6:08 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read buffer
Quoted 27 lines
Quoted 26 lines · Alexander
Quoted 26 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 9 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Quoted 4 lines
Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-
[1] https://lore.kernel.org/all/[email protected]/
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Unfortunately, it is not my call.
For now, I'll anchor this on [1]
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Also, where is this memory pressure coming from, what is the root cause and what commit does this fix? Stable backports needed? Anything else?
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
64K is order 4 allocation and may fail according to [1].
Quoted 7 lines
Quoted 5 lines
I do not think that this patch fixes any commit - the problematic code exists from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch.
From your experience, is this the right strategy?No.
Sure, I'll use
where the first time such buffer allocated and add stable here in v2.
- -
Thanks,
Sasha
Greg Kroah-Hartman
maintainerQuoted 32 lines · Alexander
Quoted 32 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 6:08 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 23 lines · Alexander
Quoted 23 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 13 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-
Yes, it's a problem, I don't understand.
Quoted 13 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Unfortunately, it is not my call.
For now, I'll anchor this on [1]Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Also, where is this memory pressure coming from, what is the root cause and what commit does this fix? Stable backports needed? Anything else?
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
64K is order 4 allocation and may fail according to [1].
And what changed to cause this to suddenly be 64k? And why can't we allocate 64k at this point in time now?
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
I do not think that this patch fixes any commit - the problematic code exists from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch.
From your experience, is this the right strategy?No.
Sure, I'll use
Fixes 3030dc056459 ("mei: add wrapper for queuing control commands.")where the first time such buffer allocated and add stable here in v2.
So the problem has been there for years? Why is it just now showing up?
thanks,
greg k-h
Usyskin, Alexander
maintainerQuoted 83 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, October 14, 2024 4:25 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 32 lines · Alexander
Quoted 32 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 6:08 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 23 lines · Alexander
Quoted 23 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 13 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-Yes, it's a problem, I don't understand.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Unfortunately, it is not my call.
For now, I'll anchor this on [1]Quoted 1 line
Quoted 1 line
Quoted 1 line
Also, where is this memory pressure coming from, what is the root
cause
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and what commit does this fix? Stable backports needed? Anything
else?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
64K is order 4 allocation and may fail according to [1].
And what changed to cause this to suddenly be 64k? And why can't we allocate 64k at this point in time now?
Quoted 1 line
Quoted 1 line
Quoted 1 line
I do not think that this patch fixes any commit - the problematic code
exists
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch. From your experience, is this the right strategy?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
No.
Sure, I'll use
Fixes 3030dc056459 ("mei: add wrapper for queuing control commands.")where the first time such buffer allocated and add stable here in v2.
So the problem has been there for years? Why is it just now showing up?
I suppose it is the combination of some fairly new FW that requests 64K buffer for content-protection case, underpowered ChromeBook and ChromeOS running content-protection flow.
All three conditions should be met to trigger this failure.
Quoted 3 lines
thanks,
greg k-h
- -
Thanks,
Sasha
Quoted 106 lines · Alexander
Quoted 83 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, October 14, 2024 4:25 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 32 lines · Alexander
Quoted 32 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 6:08 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 23 lines · Alexander
Quoted 23 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 13 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-Yes, it's a problem, I don't understand.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Unfortunately, it is not my call.
For now, I'll anchor this on [1]Quoted 1 line
Quoted 1 line
Quoted 1 line
Also, where is this memory pressure coming from, what is the root
cause
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and what commit does this fix? Stable backports needed? Anything
else?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
64K is order 4 allocation and may fail according to [1].
And what changed to cause this to suddenly be 64k? And why can't we allocate 64k at this point in time now?
Quoted 1 line
Quoted 1 line
Quoted 1 line
I do not think that this patch fixes any commit - the problematic code
exists
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch. From your experience, is this the right strategy?Quoted 8 lines
Quoted 5 lines
Quoted 1 line
No.
Sure, I'll use
Fixes 3030dc056459 ("mei: add wrapper for queuing control commands.")where the first time such buffer allocated and add stable here in v2.
So the problem has been there for years? Why is it just now showing up?
I suppose it is the combination of some fairly new FW that requests 64K buffer for content-protection case, underpowered ChromeBook and ChromeOS running content-protection flow.
All three conditions should be met to trigger this failure.Quoted 3 lines
thanks,
greg k-h
- -
Thanks,
Sasha
Brian Geffon
Tested-byQuoted 37 lines · Alexander
Quoted 37 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Monday, October 14, 2024 4:25 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 27 lines · Alexander
Quoted 27 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 6:08 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 18 lines · Alexander
Quoted 18 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Sunday, October 13, 2024 3:14 PM
To: Usyskin, Alexander <[email protected]>
Cc: Weil, Oren jer <[email protected]>; Tomas Winkler <[email protected]>; [email protected]
Subject: Re: [char-misc-next] mei: use kvmalloc for read bufferQuoted 9 lines · Alexander Usyskin
Read buffer is allocated according to max message size, reported by the firmware and may reach 64K in systems with pxp client.
Contiguous 64k allocation may fail under memory pressure. Read buffer is used as in-driver message storage and not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous memory in this case.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Signed-off-by Alexander Usyskin <[email protected]>
Quoted 51 lines
Quoted 51 lines
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
--- drivers/misc/mei/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)What about this thread:
https://lore.kernel.org/all/20240813084542.2921300-1-Yes, it's a problem, I don't understand.
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
No attribution for the reporter? Does it solve their problem?
This patch is a result from non-public bug report on ChromeOS.
Then make that bug report public as it was discussed in public already :)
Unfortunately, it is not my call.
For now, I'll anchor this on [1]Quoted 1 line
Quoted 1 line
Quoted 1 line
Also, where is this memory pressure coming from, what is the root
cause
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
and what commit does this fix? Stable backports needed? Anything
else?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The ChromeOS is extremely short on memory by design and can trigger this situation very easily.
So normal allocations are failing? That feels wrong, what caused this?
64K is order 4 allocation and may fail according to [1].
And what changed to cause this to suddenly be 64k? And why can't we allocate 64k at this point in time now?
Quoted 1 line
Quoted 1 line
Quoted 1 line
I do not think that this patch fixes any commit - the problematic code
exists
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
from the earliest versions of this driver.
As this problem reproduced only on ChromeOS I believe that no need in wide backport, the ChromeOS can cherry-pick the patch. From your experience, is this the right strategy?No.
Sure, I'll use
Fixes 3030dc056459 ("mei: add wrapper for queuing control commands.")where the first time such buffer allocated and add stable here in v2.
Quoted 7 lines
Quoted 2 lines
So the problem has been there for years? Why is it just now showing up?
I suppose it is the combination of some fairly new FW that requests 64K buffer for content-protection case, underpowered ChromeBook and ChromeOS running content-protection flow.
All three conditions should be met to trigger this failure.
That's correct we've seen this on kernels as old as 5.4. I have personally reproduced this issue and can confirm that vmalloc does fix it.
Quoted 10 lines
Quoted 4 lines
thanks,
greg k-h
- -
Thanks,
Sasha