From: Matthew Wilcox <willy@infradead.org>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: intel-xe@lists.freedesktop.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Matthew Brost <matthew.brost@intel.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/4] iov_iter: Provide copy_iomem_to|from_iter()
Date: Thu, 7 Nov 2024 20:13:55 +0000 [thread overview]
Message-ID: <Zy0fg6E7Fbmi6lsP@casper.infradead.org> (raw)
In-Reply-To: <20241107163448.2123-2-michal.wajdeczko@intel.com>
On Thu, Nov 07, 2024 at 05:34:45PM +0100, Michal Wajdeczko wrote:
> +size_t copy_iomem_to_iter(const void __iomem *from, size_t offset,
> + size_t bytes, struct iov_iter *i)
> +{
> + unsigned char buf[SMP_CACHE_BYTES];
> + size_t progress = 0, copied, len;
> +
> + from += offset;
> + while (bytes) {
> + len = min(bytes, sizeof(buf));
> + memcpy_fromio(buf, from + progress, len);
> + copied = _copy_to_iter(buf, len, i);
> + if (!copied)
> + break;
> + bytes -= copied;
> + progress += copied;
> + }
This seems like a rather sad implementation. Why not:
if (WARN_ON_ONCE(i->data_source))
return 0;
if (user_backed_iter(i))
might_fault();
return iterate_and_advance(i, bytes, (void *)addr,
copy_iomem_to_iter, memcpy_iomem_to_iter);
along with
size_t memcpy_iomem_to_iter()
{
memcpy_fromio(iter_to, from + progress, len);
return 0;
}`
next prev parent reply other threads:[~2024-11-07 20:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 16:34 [PATCH 0/4] Add iomem helpers for use from debugfs Michal Wajdeczko
2024-11-07 16:34 ` [PATCH 1/4] iov_iter: Provide copy_iomem_to|from_iter() Michal Wajdeczko
2024-11-07 20:13 ` Matthew Wilcox [this message]
2024-11-07 16:34 ` [PATCH 2/4] libfs: Provide simple_read_from|write_to_iomem() Michal Wajdeczko
2024-11-07 16:34 ` [PATCH 3/4] drm/xe: Add read/write debugfs helpers for GGTT node Michal Wajdeczko
2024-11-07 16:34 ` [PATCH 4/4] drm/xe/pf: Expose access to the VF GGTT PTEs over debugfs Michal Wajdeczko
2024-11-07 16:40 ` ✓ CI.Patch_applied: success for Add iomem helpers for use from debugfs Patchwork
2024-11-07 16:40 ` ✓ CI.checkpatch: " Patchwork
2024-11-07 16:41 ` ✓ CI.KUnit: " Patchwork
2024-11-07 16:53 ` ✓ CI.Build: " Patchwork
2024-11-07 16:55 ` ✓ CI.Hooks: " Patchwork
2024-11-07 16:57 ` ✗ CI.checksparse: warning " Patchwork
2024-11-07 17:17 ` ✓ CI.BAT: success " Patchwork
2024-11-08 23:39 ` ✗ CI.FULL: failure " Patchwork
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=Zy0fg6E7Fbmi6lsP@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
--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.