From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Tony Luck <tony.luck@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Lutomirski <luto@kernel.org>,
Dan Williams <dan.j.williams@intel.com>, Robert <elliott@hpe.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
linux-nvdimm <linux-nvdimm@ml01.01.org>, X86-ML <x86@kernel.org>
Subject: Re: [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit)
Date: Mon, 4 Jan 2016 22:02:28 +0100 [thread overview]
Message-ID: <20160104210228.GR22941@pd.tnic> (raw)
In-Reply-To: <CALCETrU9AN6HmButY0tV1F4syNHZVKyQyVvit2JHcHAuXK9XNA@mail.gmail.com>
On Mon, Jan 04, 2016 at 10:08:43AM -0800, Andy Lutomirski wrote:
> All of that's correct, including the part where it's confusing. The
> comments aren't the best.
>
> How about adding a comment like:
>
> ----- begin comment -----
>
> The offset to the fixup is signed, and we're trying to use the high
> bits for a different purpose. In C, we could just do:
>
> u32 class_and_offset = ((target - here) & 0x3fffffff) | class;
>
> Then, to decode it, we'd mask off the class and sign-extend to recover
> the offset.
>
> In asm, we can't do that, because this all gets laundered through the
> linker, and there's no relocation type that supports this chicanery.
> Instead we cheat a bit. We first add a large number to the offset
> (0x20000000). The result is still nominally signed, but now it's
> always positive, and the two high bits are always clear. We can then
> set high bits by ordinary addition or subtraction instead of using
> bitwise operations. As far as the linker is concerned, all we're
> doing is adding a large constant to the difference between here (".")
> and the target, and that's a valid relocation type.
>
> In the C code, we just mask off the class bits and subtract 0x20000000
> to get the offset.
>
> ----- end comment -----
Yeah, that makes more sense, thanks.
That nasty "." current position thing stays in the way to do it cleanly. :-)
Anyway, ok, I see it now. It still feels a bit hacky to me. I probably
would've added the third int to the exception table instead. It would've
been much more straightforward and clean this way and I'd gladly pay the
additional 6K growth.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-01-04 21:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 1:02 [PATCH v6 0/4] Machine check recovery when kernel accesses poison Tony Luck
2015-12-30 17:59 ` [PATCH v6 1/4] x86: Clean up extable entry format (and free up a bit) Andy Lutomirski
2016-01-04 1:37 ` Tony Luck
2016-01-04 7:49 ` Ingo Molnar
2016-01-04 12:07 ` Borislav Petkov
2016-01-04 17:26 ` Tony Luck
2016-01-04 18:08 ` Andy Lutomirski
2016-01-04 18:59 ` Tony Luck
2016-01-04 19:05 ` Andy Lutomirski
2016-01-04 21:02 ` Borislav Petkov [this message]
2016-01-04 22:29 ` Andy Lutomirski
2016-01-04 23:02 ` Borislav Petkov
2016-01-04 23:04 ` Borislav Petkov
2016-01-04 23:25 ` Andy Lutomirski
2016-01-05 11:20 ` Borislav Petkov
2016-01-04 23:11 ` Tony Luck
2015-12-30 18:56 ` [PATCH v6 2/4] x86: Cleanup and add a new exception class Tony Luck
2016-01-04 14:22 ` Borislav Petkov
2016-01-04 17:00 ` Luck, Tony
2016-01-04 20:32 ` Borislav Petkov
2016-01-04 22:23 ` Andy Lutomirski
2015-12-31 19:40 ` [PATCH v6 3/4] x86, mce: Check for faults tagged in EXTABLE_CLASS_FAULT exception table entries Tony Luck
2015-12-31 19:43 ` [PATCH v6 4/4] x86, mce: Add __mcsafe_copy() Tony Luck
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=20160104210228.GR22941@pd.tnic \
--to=bp@alien8.de \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=elliott@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=tony.luck@gmail.com \
--cc=x86@kernel.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