mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "hui.wang@canonical.com" <hui.wang@canonical.com>,
	"mwalle@kernel.org" <mwalle@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"florent.trinh-thai@cs-soprasteria.com"
	<florent.trinh-thai@cs-soprasteria.com>,
	"arnd@arndb.de" <arnd@arndb.de>
Subject: Re: [PATCH] eeprom: at25: convert to spi-mem API
Date: Sat, 8 Nov 2025 17:24:06 +0100	[thread overview]
Message-ID: <ad87d404-3d93-4c7e-908a-d9f47daca4b0@csgroup.eu> (raw)
In-Reply-To: <cd174dbaa3171f92e083d5dca89732aa64e32f15.camel@siemens.com>



Le 08/11/2025 à 12:41, Sverdlin, Alexander a écrit :
> Hi Christophe,
> 
> On Sat, 2025-11-08 at 12:14 +0100, Christophe Leroy wrote:
>>> Now I'm trying to understand why the problem surfaced with commit
>>> 8ad6249c51d0 ("eeprom: at25: convert to spi-mem API")
>>>
>>
>> The reason why it was not a problem before was that the transfer was
>> done into of->prealloc_buf (fs/kernfs/file.c) which is a kmalloc() with
>> size (PAGE_SIZE + 1).
>>
>> Following the rework of at25 it now goes into the bounce buffer which is
>> allocated with the exact size of the transfer.
>>
>> Why do we need an intermediate bounce buffer now, why can't
>> of->prealloc_buf be used directly as before ?
> 
> userspace access is only one part of the story, the other is NVMEM
> kernel-internal API, like nvmem_cell_read*() and I suppose there is
> no requirement for a destination buffer to be DMA-able.
> 

As far as I can see nvmem_cell_read*() allocates a kmalloc() bounce 
buffer already:

	buf = kzalloc(max_t(size_t, entry->raw_len, entry->bytes), GFP_KERNEL);
	if (!buf)
		return ERR_PTR(-ENOMEM);

	rc = __nvmem_cell_read(nvmem, cell->entry, buf, len, cell->id, 
cell->index);
	if (rc) {
		kfree(buf);
		return ERR_PTR(rc);
	}

	return buf;

Christophe

  reply	other threads:[~2025-11-08 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 22:28 A. Sverdlin
2025-07-04 10:09 ` Arnd Bergmann
2025-11-03 16:33 ` Christophe Leroy
2025-11-03 19:12   ` Sverdlin, Alexander
2025-11-03 21:46     ` Christophe Leroy
2025-11-03 22:29       ` Sverdlin, Alexander
2025-11-03 22:36         ` Christophe Leroy
2025-11-04 13:13           ` Sverdlin, Alexander
2025-11-04 13:24             ` Christophe Leroy
2025-11-04 23:15   ` Greg Kroah-Hartman
2025-11-05  7:20     ` Sverdlin, Alexander
2025-11-07 11:49       ` Sverdlin, Alexander
2025-11-07 13:08         ` Arnd Bergmann
2025-11-07 13:44           ` Sverdlin, Alexander
2025-11-08 10:05         ` Christophe Leroy
2025-11-08 11:14           ` Christophe Leroy
2025-11-08 11:41             ` Sverdlin, Alexander
2025-11-08 16:24               ` Christophe Leroy [this message]
2025-11-10 15:09                 ` Sverdlin, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad87d404-3d93-4c7e-908a-d9f47daca4b0@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=alexander.sverdlin@siemens.com \
    --cc=arnd@arndb.de \
    --cc=florent.trinh-thai@cs-soprasteria.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hui.wang@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwalle@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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®