From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>,
"linux-snps-arc@lists.infradead.org"
<linux-snps-arc@lists.infradead.org>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
"jbaron@redhat.com" <jbaron@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] ARC: ARCv2: jump label: implement jump label patching
Date: Wed, 17 Jul 2019 18:54:59 +0000 [thread overview]
Message-ID: <401bc54416a106141b0ec785bfd9198ed56a84d8.camel@synopsys.com> (raw)
In-Reply-To: <BN6PR1201MB0035E304FF25609CBCACBD09B6C90@BN6PR1201MB0035.namprd12.prod.outlook.com>
On Wed, 2019-07-17 at 17:45 +0000, Vineet Gupta wrote:
> On 7/17/19 8:09 AM, Eugeniy Paltsev wrote:
> > > > +/* Halt system on fatal error to make debug easier */
> > > > +#define arc_jl_fatal(format...) \
> > > > +({ \
> > > > + pr_err(JUMPLABEL_ERR format); \
> > > > + BUG(); \
> > > Does it make sense to bring down the whole system vs. failing and returning.
> > > I see there is no error propagation to core code, but still.
> > I totally agree with Peter, and I prefer to stop the system on this errors. Here is few arguments:
> > All this checks can't be toggle in system operating normally and only may be caused by bad code generation (or some code/data corruption):
> > 1) We got our instruction to patch unaligned by 4 bytes (despite the fact that we used '.balign 4' to align it)
> > 2) We got branch offset unaligned (which means that we calculate it wrong at build time or corrupt it in run time)
> > 3) We got branch offset which not fits into s25. As this is offset inside one function (inside one 'if' statement actually) we newer get such huge
> > offset in real life if code generation is ok.
>
> I understand that. But AFAIKR in implementation arc_jl_fatal() gets called before
> we have done the actual code patching and/or flushing the caches
Correct.
> to that effect.
> So harm has been done just yet. We just need to make sure that any book-keeping of
> true/false is not yet done or unrolled.
Can you describe your proposal in more detail?
Be noted that in case (2) or (3) we know that we are not able to generate correct instruction for replace existing one. And we don't know anything
about the real cause.
So what we can do here besides that we warn about it?
-We can halt the system to make debug easy (which I propose)
-We can generate invalid instruction.
-We can just skip this patching. In that case we'll end with some 'if' statements [in kernel code] working incorrectly. I really don't want to debug
this.
Given that we'll never face with this asserts in any consistent state I don't see any reason why we shouldn't simply call BUG() here.
>
> > If we only warn to log and return we will face with compromised kernel flow later.
> > I.E. it could be 'if' statement in kernel text which is switched to wrong state: the condition is true but we take the false branch.
> > And It will be the issue which is much more difficult to debug.
> >
> > Does it sound reasonably?
>
> I'm still not convinced that by hitting the _fatal() we are in some inconsistent
> state already. But if u feel strongly lets keep it.
>
> > If you really don't want to have BUG here, I can make it conditionally enabled
>
> Not a good idea. It is unconditionally present or not. Not something in between.
>
> > in depend on CONFIG_ARC_STATIC_KEYS_DEBUG as I want to have it enabled at least on ARC development platforms.
>
>
--
Eugeniy Paltsev
prev parent reply other threads:[~2019-07-17 18:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 16:40 Eugeniy Paltsev
2019-06-18 16:16 ` Vineet Gupta
2019-06-19 8:12 ` Peter Zijlstra
2019-06-19 23:55 ` Vineet Gupta
2019-06-20 7:01 ` Peter Zijlstra
2019-06-20 18:34 ` Eugeniy Paltsev
2019-06-20 21:30 ` Peter Zijlstra
2019-06-20 18:48 ` Vineet Gupta
2019-06-20 21:22 ` Peter Zijlstra
2019-06-21 12:09 ` Peter Zijlstra
2019-06-21 12:12 ` Peter Zijlstra
2019-06-21 18:37 ` Nadav Amit
2019-06-20 7:15 ` Peter Zijlstra
2019-06-20 7:21 ` Peter Zijlstra
2019-06-20 7:52 ` Peter Zijlstra
2019-06-20 20:49 ` Vineet Gupta
2019-06-21 15:39 ` Alexey Brodkin
2019-06-20 18:34 ` Eugeniy Paltsev
2019-06-20 21:12 ` Peter Zijlstra
2019-06-28 22:59 ` Vineet Gupta
2019-07-03 16:15 ` Vineet Gupta
2019-07-17 15:09 ` Eugeniy Paltsev
2019-07-17 17:45 ` Vineet Gupta
2019-07-17 18:54 ` Eugeniy Paltsev [this message]
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=401bc54416a106141b0ec785bfd9198ed56a84d8.camel@synopsys.com \
--to=eugeniy.paltsev@synopsys.com \
--cc=Alexey.Brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=ard.biesheuvel@linaro.org \
--cc=jbaron@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.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®