mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool
@ 2024-04-08 21:52 Sandeep Dhavale
  2024-04-08 22:48 ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Sandeep Dhavale @ 2024-04-08 21:52 UTC (permalink / raw)
  To: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Sandeep Dhavale, Chunhai Guo
  Cc: linux-erofs, syzbot+27cc650ef45b379dfe5a, kernel-team, linux-kernel

erofs will decompress in the preemptible context (kworker or per cpu
thread). As smp_processor_id() cannot be used in preemptible contexts,
use raw_smp_processor_id() instead to index into global buffer pool.

Reported-by: syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com
Fixes: 7a7513292cc6 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
---
 fs/erofs/zutil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c
index b9b99158bb4e..036024bce9f7 100644
--- a/fs/erofs/zutil.c
+++ b/fs/erofs/zutil.c
@@ -30,7 +30,7 @@ static struct shrinker *erofs_shrinker_info;
 
 static unsigned int z_erofs_gbuf_id(void)
 {
-	return smp_processor_id() % z_erofs_gbuf_count;
+	return raw_smp_processor_id() % z_erofs_gbuf_count;
 }
 
 void *z_erofs_get_gbuf(unsigned int requiredpages)
-- 
2.44.0.478.gd926399ef9-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool
  2024-04-08 21:52 [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool Sandeep Dhavale
@ 2024-04-08 22:48 ` Gao Xiang
  2024-04-08 23:05   ` Sandeep Dhavale
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2024-04-08 22:48 UTC (permalink / raw)
  To: Sandeep Dhavale, Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Chunhai Guo
  Cc: linux-erofs, syzbot+27cc650ef45b379dfe5a, kernel-team, linux-kernel

Hi Sandeep,

On 2024/4/9 05:52, Sandeep Dhavale wrote:
> erofs will decompress in the preemptible context (kworker or per cpu
> thread). As smp_processor_id() cannot be used in preemptible contexts,
> use raw_smp_processor_id() instead to index into global buffer pool.
> 
> Reported-by: syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com
> Fixes: 7a7513292cc6 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
> Signed-off-by: Sandeep Dhavale <dhavale@google.com>

Thanks for catching this, since the original patch is
for next upstream cycle, may I fold this fix in the
original patch?

I will add your credit into the original patch.

Thanks,
Gao Xiang

> ---
>   fs/erofs/zutil.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c
> index b9b99158bb4e..036024bce9f7 100644
> --- a/fs/erofs/zutil.c
> +++ b/fs/erofs/zutil.c
> @@ -30,7 +30,7 @@ static struct shrinker *erofs_shrinker_info;
>   
>   static unsigned int z_erofs_gbuf_id(void)
>   {
> -	return smp_processor_id() % z_erofs_gbuf_count;
> +	return raw_smp_processor_id() % z_erofs_gbuf_count;
>   }
>   
>   void *z_erofs_get_gbuf(unsigned int requiredpages)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool
  2024-04-08 22:48 ` Gao Xiang
@ 2024-04-08 23:05   ` Sandeep Dhavale
  2024-04-08 23:20     ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Sandeep Dhavale @ 2024-04-08 23:05 UTC (permalink / raw)
  To: Gao Xiang
  Cc: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Chunhai Guo, linux-erofs,
	syzbot+27cc650ef45b379dfe5a, kernel-team, linux-kernel

>
> Thanks for catching this, since the original patch is
> for next upstream cycle, may I fold this fix in the
> original patch?
>
Hi Gao,
Sounds good. As the fix is simple, it makes sense to fold it into the
original one.

Thanks,
Sandeep.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool
  2024-04-08 23:05   ` Sandeep Dhavale
@ 2024-04-08 23:20     ` Gao Xiang
  0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2024-04-08 23:20 UTC (permalink / raw)
  To: Sandeep Dhavale
  Cc: Gao Xiang, Chao Yu, Yue Hu, Jeffle Xu, Chunhai Guo, linux-erofs,
	syzbot+27cc650ef45b379dfe5a, kernel-team, linux-kernel



On 2024/4/9 07:05, Sandeep Dhavale wrote:
>>
>> Thanks for catching this, since the original patch is
>> for next upstream cycle, may I fold this fix in the
>> original patch?
>>
> Hi Gao,
> Sounds good. As the fix is simple, it makes sense to fold it into the
> original one.
> 
> Thanks,
> Sandeep.

Thanks, folded.

Thanks,
Gao Xiang

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-08 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 21:52 [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool Sandeep Dhavale
2024-04-08 22:48 ` Gao Xiang
2024-04-08 23:05   ` Sandeep Dhavale
2024-04-08 23:20     ` Gao Xiang

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

all inboxes | Powered by JetHome®