linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: y2038 Mailman List <y2038@lists.linaro.org>,
	Tyler Baicar <tbaicar@codeaurora.org>,
	Will Deacon <will.deacon@arm.com>, Ingo Molnar <mingo@kernel.org>,
	Borislav Petkov <bp@suse.de>,
	Yazen Ghannam <yazen.ghannam@amd.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	gengdongjiu <gengdongjiu@huawei.com>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] efi: cper: avoid using get_seconds()
Date: Mon, 18 Jun 2018 17:54:06 +0200	[thread overview]
Message-ID: <CAK8P3a0xkPrDhoHaUzcN++b7TEh3v_a=VkP6VX9_FD56pG1A6w@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu9OD6s24Aq1bLBr-yq_tn6wPR0TAkddO+VTwM7jR76dOQ@mail.gmail.com>

On Mon, Jun 18, 2018 at 5:50 PM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
> On 18 June 2018 at 17:49, Arnd Bergmann <arnd@arndb.de> wrote:
>> On Mon, Jun 18, 2018 at 5:47 PM, Ard Biesheuvel
>> <ard.biesheuvel@linaro.org> wrote:
>>> On 18 June 2018 at 16:17, Arnd Bergmann <arnd@arndb.de> wrote:
>>
>>>> -               atomic64_set(&seq, ((u64)get_seconds()) << 32);
>>>> +       if (!atomic64_read(&seq)) {
>>>> +               time64_t time = ktime_get_real_seconds();
>>>> +
>>>> +               /*
>>>> +                * This code is unlikely to still be needed in year 2106,
>>>> +                * but just in case, let's use a few more bits for timestamps
>>>> +                * after y2038 to be sure they keep increasing monotonically
>>>> +                * for the next few hundred years...
>>>> +                */
>>>> +               if (time < 0x80000000)
>>>> +                       atomic64_set(&seq, (ktime_get_real_seconds()) << 32);
>>>> +               else
>>>> +                       atomic64_set(&seq, 0x8000000000000000ull |
>>>> +                                          ktime_get_real_seconds() << 24);
>>>> +       }
>>>
>>> Given that these values are never decoded and interpreted as
>>> timestamps, can't we simply switch to the second flavour immediately?
>>
>> I considered that, but the downside would be that all future filenames would
>> come before all past file names.
>
> Won't we have that same problem in 2038?

No, it goes from 0x7fffffff00000000 to 0x8000000000000000, followed
by 0x8000000001000000.

       Arnd

  reply	other threads:[~2018-06-18 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 14:17 [PATCH] efi: cper: avoid using get_seconds() Arnd Bergmann
2018-06-18 15:47 ` Ard Biesheuvel
2018-06-18 15:49   ` Arnd Bergmann
2018-06-18 15:50     ` Ard Biesheuvel
2018-06-18 15:54       ` Arnd Bergmann [this message]
2018-06-18 15:56         ` Ard Biesheuvel

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='CAK8P3a0xkPrDhoHaUzcN++b7TEh3v_a=VkP6VX9_FD56pG1A6w@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bp@suse.de \
    --cc=gengdongjiu@huawei.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tbaicar@codeaurora.org \
    --cc=will.deacon@arm.com \
    --cc=y2038@lists.linaro.org \
    --cc=yazen.ghannam@amd.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 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).