From: Bjorn Helgaas <helgaas@kernel.org>
To: Casey Leedom <leedom@chelsio.com>
Cc: Hariprasad S <hariprasad@chelsio.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
SWise OGC <swise@opengridcomputing.com>,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH] pci: Use same logic in pci_vpd_read as that of pci_vpd_write
Date: Thu, 18 Aug 2016 15:55:25 -0500 [thread overview]
Message-ID: <20160818205524.GO27353@localhost> (raw)
In-Reply-To: <DM5PR12MB17864DB8AA81CBA21EBB7AA8C81B0@DM5PR12MB1786.namprd12.prod.outlook.com>
Hi Casey,
Sorry for the delay in responding.
On Mon, Aug 08, 2016 at 09:20:22PM +0000, Casey Leedom wrote:
> | From: Bjorn Helgaas <helgaas@kernel.org>
> | Sent: Monday, August 8, 2016 2:08 PM
> |
> | I think the existing semantics are the same as for the read(2)
> | syscall: we return the number of bytes read, which may be less than
> | the size requested, and callers may use random garbage if they don't
> | check for short reads.
>
> read(2) is a generic I/O system call, which maintains a read pointer with
> lseek(2) semantics, etc. This seems like an Apples and Oranges
> comparison.
>
> | If we make pci_read_vpd() return error instead of a short read, how do
> | callers figure out how much to request?
>
> The same question could be asked of the pci_write_vpd() call which
> currently throws an error is any portion of the requested write is beyond
> the recorded VPD area. Also, isn't this what (struct pci_dev *)->vpd.len
> is for? Although I think we'd want an API to retrieve that rather than have
> callers simply access the potentially uninitialized field which is lazily
> initialized. On the other hand, we don't seem to have any current callers
> with this issue.
Drivers that read VPD probably can figure out how much to read. The
place I'm worried about is read_vpd_attr(), the hook for reading VPD
via sysfs. If we do something like "cat /sys/.../vpd", I think cat
will try to read a large chunk and it will currently get a short read.
If we return an error instead of the short read, I think the sysfs
file will be much harder to use.
Bjorn
next prev parent reply other threads:[~2016-08-19 1:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-25 4:08 [PATCH] pci: Use same logic in pci_vpd_read as that of pci_vpd_write Hariprasad Shenai
2016-08-08 21:08 ` Bjorn Helgaas
2016-08-08 21:20 ` Casey Leedom
2016-08-18 20:55 ` Bjorn Helgaas [this message]
2016-09-13 22:16 ` Casey Leedom
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=20160818205524.GO27353@localhost \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=hare@suse.de \
--cc=hariprasad@chelsio.com \
--cc=leedom@chelsio.com \
--cc=linux-pci@vger.kernel.org \
--cc=swise@opengridcomputing.com \
/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.