From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Tong Tiangen <tongtiangen@huawei.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: linux-next: build warning after merge of the vfs-brauner tree
Date: Wed, 6 Mar 2024 10:55:43 +0100 [thread overview]
Message-ID: <20240306-staufer-parklandschaft-0b0c0532ac91@brauner> (raw)
In-Reply-To: <CAHk-=wiJLeR6tPcEmiRndhVtrPex0WavrFZ0UZHGjABVc=Tq1w@mail.gmail.com>
On Tue, Mar 05, 2024 at 08:47:40PM -0800, Linus Torvalds wrote:
> On Tue, 5 Mar 2024 at 20:37, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > +static struct page *dump_page_copy(struct page *src, struct page *dst)
> > +{
> > + return NULL;
> > +}
>
> No, it needs to be "return src;" not NULL.
>
> That
>
> #define dump_page_copy(src, dst) ((dst), (src))
>
> was supposed to be a "use 'dst', return 'src'" macro, and is correct
> as that. The problem - as you noticed - is that it causes that "left
> side of comma expression has no effect" warning.
>
> (Technically it *does* have an effect - exactly the "argument is used"
> one - but the compiler warning does make sense).
>
> Actually, the simplest thing to do is probably just
>
> #define dump_page_free(x) ((void)(x))
> #define dump_page_copy(src, dst) (src)
>
> where the "use" of the 'dump_page' argument is that dump_page_free()
> void cast, and dump_page_copy() simply doesn't need to use it at all.
>
> Christian?
I would just do it like Stephen did (but returning src ofc) because it's
symmetric to the #ifdef copy_mc_to_kernel definition of dump_page_copy()
and seems easier to read to me.
But I honestly don't care too much. So I'd pick Stephen's change and if
you prefer to do it differently just change it when I send you the pr.
+/*
+ * If we might get machine checks from kernel accesses during the
+ * core dump, let's get those errors early rather than during the
+ * IO. This is not performance-critical enough to warrant having
+ * all the machine check logic in the iovec paths.
+ */
+#ifdef copy_mc_to_kernel
+
+#define dump_page_alloc() alloc_page(GFP_KERNEL)
+#define dump_page_free(x) __free_page(x)
+static struct page *dump_page_copy(struct page *src, struct page *dst)
+{
+ void *buf = kmap_local_page(src);
+ size_t left = copy_mc_to_kernel(page_address(dst), buf, PAGE_SIZE);
+ kunmap_local(buf);
+ return left ? NULL : dst;
+}
+
+#else
+
+/* We just want to return non-NULL; it's never used. */
+#define dump_page_alloc() ERR_PTR(-EINVAL)
+#define dump_page_free(x) ((void)(x))
+static inline struct page *dump_page_copy(struct page *src, struct page *dst)
+{
+ return src;
+}
+#endif
next prev parent reply other threads:[~2024-03-06 9:55 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 23:51 Stephen Rothwell
2024-03-06 2:48 ` Linus Torvalds
2024-03-06 4:37 ` Stephen Rothwell
2024-03-06 4:47 ` Linus Torvalds
2024-03-06 9:55 ` Christian Brauner [this message]
2024-03-06 4:58 ` Stephen Rothwell
-- strict thread matches above, loose matches on Subject: below --
2025-11-12 2:46 Stephen Rothwell
2025-06-17 5:12 Stephen Rothwell
2025-08-01 4:38 ` Stephen Rothwell
2025-08-04 12:33 ` Christian Brauner
2025-02-28 7:55 Stephen Rothwell
2025-02-28 10:37 ` Christian Brauner
2025-02-19 4:34 Stephen Rothwell
2025-02-19 8:45 ` Bagas Sanjaya
2025-02-19 10:04 ` Christian Brauner
2025-02-19 11:23 ` Bagas Sanjaya
2025-02-19 21:12 ` NeilBrown
2024-10-30 5:24 Stephen Rothwell
2024-10-01 3:39 Stephen Rothwell
2024-10-01 15:05 ` Christian Brauner
2024-09-30 23:11 Stephen Rothwell
2024-10-01 4:19 ` Stephen Rothwell
2024-10-01 15:00 ` Christian Brauner
2024-10-07 22:58 ` Stephen Rothwell
2024-09-06 8:29 Stephen Rothwell
2024-09-18 5:24 ` Stephen Rothwell
2024-10-02 22:45 ` Stephen Rothwell
2024-10-03 9:11 ` Christian Brauner
2024-08-29 6:19 Stephen Rothwell
2024-08-26 6:01 Stephen Rothwell
2024-08-26 16:00 ` Pankaj Raghav (Samsung)
2024-08-13 3:40 Stephen Rothwell
2024-08-28 5:22 ` Stephen Rothwell
2024-08-01 5:55 Stephen Rothwell
2024-08-01 5:56 ` Stephen Rothwell
2024-08-01 5:01 Stephen Rothwell
2024-08-01 13:21 ` David Howells
2024-08-01 13:41 ` Christian Brauner
2024-05-28 0:49 Stephen Rothwell
2024-05-28 3:31 ` Stephen Rothwell
2024-05-28 12:30 ` Christian Brauner
2024-05-28 12:39 ` Arnd Bergmann
2024-01-17 2:39 Stephen Rothwell
2023-12-21 7:48 Stephen Rothwell
2023-12-21 13:19 ` David Howells
2023-11-24 2:13 Stephen Rothwell
2023-11-24 7:58 ` Amir Goldstein
2023-09-25 4:31 Stephen Rothwell
2023-08-15 11:15 Stephen Rothwell
2023-08-07 5:38 Stephen Rothwell
2023-07-31 3:58 Stephen Rothwell
2023-07-04 3:51 Stephen Rothwell
2023-05-24 3:46 Stephen Rothwell
2023-05-24 9:06 ` Christian Brauner
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=20240306-staufer-parklandschaft-0b0c0532ac91@brauner \
--to=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=tongtiangen@huawei.com \
--cc=torvalds@linux-foundation.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®