From: Jeff Layton <jlayton@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>, Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [jlayton:mgtime 5/13] inode.c:undefined reference to `__invalid_cmpxchg_size'
Date: Tue, 09 Jul 2024 11:27:40 -0400 [thread overview]
Message-ID: <edd2d831320fb14333e605e77d4b284b1123eb86.camel@kernel.org> (raw)
In-Reply-To: <92726965-19a0-433b-9b49-69af84b25081@app.fastmail.com>
On Tue, 2024-07-09 at 17:07 +0200, Arnd Bergmann wrote:
> On Tue, Jul 9, 2024, at 16:23, Jeff Layton wrote:
> > On Tue, 2024-07-09 at 16:16 +0200, Arnd Bergmann wrote:
> > > On Tue, Jul 9, 2024, at 15:45, Geert Uytterhoeven wrote:
> >
> > I think the simplest solution is to make the floor value I'm
> > tracking
> > be an atomic64_t. That looks like it should smooth over the
> > differences
> > between arches. I'm testing a patch to do that now.
>
> Yes, atomic64_t should work, but be careful about using this
> in a fast path since it can turn into a global spinlock
> in lib/atomic64.c on architectures that don't support it
> natively.
>
> I'm still reading through the rest of your series, but
> it appears that you pass the time value into
> ktime_to_timespec64() directly afterwards, so I guess
> that is already a fairly large overhead on 32-bit
> architectures and an extra spinlock doesn't hurt too
> much.
>
Thanks Arnd.
The context for this is generally a write or other change to an inode,
so I too am hoping the overhead won't be too bad. It does take great
pains to avoid changing the ctime_floor value whenever possible.
> Two more things I noticed in your patch:
>
> - smp_load_acquire() on a 64-bit variable seems problematic
> as well, maybe this needs a spinlock on 32-bit
> architectures?
>
That should go away with the conversion of ctime_floor to atomic64_t.
AFAICT, arches that don't have native a 64-bit cmpxchg op usually
emulate that with hashed spinlocks.
> - for the coarse_ctime function, I think you should be
> able to avoid the conversion to timespec by just calling
> ktime_get_coarse_real_ts64() again instead of converting
> monotonic to real and then to timespec.
>
Note that we might get different values for the coarse timestamps, but
if we do then the second fetch will just be a little later (which is
OK). I'll plan to make this change.
> - inode_set_ctime_current() seems to now store a fine-grained
> timespec in the inode even for the !is_mgtime case, skipping
> the timestamp_truncate() step. This appears to potentially
> leak a non-truncated value to userspace, which would be
> inconsistent with the value read back from disk.
Oof, you're right. I'll fix that up for the next version.
Thanks for the review!
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-07-09 15:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <202407091931.mztaeJHw-lkp@intel.com>
2024-07-09 11:58 ` Fwd: [jlayton:mgtime 5/13] inode.c:undefined reference to `__invalid_cmpxchg_size' Jeff Layton
2024-07-09 13:45 ` Geert Uytterhoeven
2024-07-09 14:16 ` Arnd Bergmann
2024-07-09 14:23 ` Jeff Layton
2024-07-09 15:07 ` Arnd Bergmann
2024-07-09 15:27 ` Jeff Layton [this message]
2024-07-09 17:06 ` Arnd Bergmann
2024-07-09 18:27 ` Jeff Layton
2024-07-10 8:38 ` Arnd Bergmann
2024-07-10 11:57 ` Jeff Layton
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=edd2d831320fb14333e605e77d4b284b1123eb86.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=arnd@arndb.de \
--cc=geert@linux-m68k.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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;
as well as URLs for NNTP newsgroup(s).