All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Gupta <sidgup@codeaurora.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: mcgrof@kernel.org, rafael@kernel.org, viro@zeniv.linux.org.uk,
	linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"psodagud@codeaurora.org" <psodagud@codeaurora.org>
Subject: Re: PROBLEM: Firmware loader fallback mechanism no longer works with sendfile
Date: Tue, 12 Jan 2021 10:31:26 -0800	[thread overview]
Message-ID: <1adf9aa4-ed7e-8f05-a354-57419d61ec18@codeaurora.org> (raw)
In-Reply-To: <X/hv634I9JOoHZRk@kroah.com>


On 1/8/2021 6:44 AM, Greg KH wrote:
> On Thu, Jan 07, 2021 at 02:03:47PM -0800, Siddharth Gupta wrote:
>> On 1/6/2021 2:33 AM, Greg KH wrote:
>>>>>> Since the binary attributes don't support splice_{read,write} functions the
>>>>>> calls to splice_{read,write} used the default kernel_{read,write} functions.
>>>>>> With the above change this results in an -EINVAL return from
>>>>>> do_splice_from[4].
>>>>>>
>>>>>> This essentially means that sendfile will not work for any binary attribute
>>>>>> in the sysfs.
>>>>> Have you tried fixing this with a patch much like what we did for the
>>>>> proc files that needed this?  If not, can you?
>>>> I am not aware of this fix, could you provide me a link for reference? I
>>>> will try it out.
>>> Look at the series of commits starting at fe33850ff798 ("proc: wire up
>>> generic_file_splice_read for iter ops") for how this was fixed in procfs
>>> as an example of what also needs to be done for binary sysfs files.
>> I tried to follow these fixes, but I am unfamiliar with fs code. I don't see
>> the generic_file_splice_write function anymore on newer kernels, also AFAICT
>> kernfs_ops does not define {read,write}_iter operations. If the solution is
>> simple and someone could provide the patches I would be happy to test them
>> out. If not, some more information about how to proceed would be nice.
> Can you try this tiny patch out below?
Sorry for the delay, I tried out the patch, but I am still seeing the 
error. Please take a look at these logs with
android running in the userspace[1]:

[   62.295056][  T249] remoteproc remoteproc1: powering up 
xxxxxxxx.remoteproc-cdsp
[   62.304138][  T249] remoteproc remoteproc1: Direct firmware load for 
cdsp.mdt failed with error -2
[   62.312976][  T249] remoteproc remoteproc1: Falling back to sysfs 
fallback for: cdsp.mdt
[   62.469748][  T394] ueventd: firmware: loading 'cdsp.mdt' for 
'/devices/platform/soc/xxxxxxxx.remoteproc-cdsp/remoteproc/remoteproc1/cdsp.mdt'
[   62.498700][  T394] ueventd: firmware: sendfile failed { 
'/sys/devices/platform/soc/xxxxxxxx.remoteproc-cdsp/remoteproc/remoteproc1/cdsp.mdt', 
'cdsp.mdt' }: Invalid argument

Thanks,
Sid

[1]: 
https://android.googlesource.com/platform/system/core/+/refs/heads/master/init/firmware_handler.cpp#57
>
> thanks,
>
> greg k-h
>
> diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
> index f277d023ebcd..113bc816d430 100644
> --- a/fs/kernfs/file.c
> +++ b/fs/kernfs/file.c
> @@ -968,6 +968,8 @@ const struct file_operations kernfs_file_fops = {
>   	.release	= kernfs_fop_release,
>   	.poll		= kernfs_fop_poll,
>   	.fsync		= noop_fsync,
> +	.splice_read	= generic_file_splice_read,
> +	.splice_write	= iter_file_splice_write,
>   };
>   
>   /**

  reply	other threads:[~2021-01-12 18:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 22:43 PROBLEM: Firmware loader fallback mechanism no longer works with sendfile Siddharth Gupta
2021-01-05  6:36 ` Greg KH
2021-01-06  1:00   ` Siddharth Gupta
2021-01-06 10:33     ` Greg KH
2021-01-07 22:03       ` Siddharth Gupta
2021-01-08 14:44         ` Greg KH
2021-01-12 18:31           ` Siddharth Gupta [this message]
2021-01-15 16:20             ` Greg KH
2021-01-18  0:59               ` Siddharth Gupta
2021-01-20  9:10 ` Christoph Hellwig
2021-01-20 20:28   ` Siddharth Gupta

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=1adf9aa4-ed7e-8f05-a354-57419d61ec18@codeaurora.org \
    --to=sidgup@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=psodagud@codeaurora.org \
    --cc=rafael@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.