Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620459 > unrolled thread

Re: [PATCH v3] ia64: fix module loading for gcc-5.4+

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-10 19:30 +0200
Last post2017-04-11 00:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3] ia64: fix module loading for gcc-5.4+ SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-10 19:30 +0200
    Re: [PATCH v3] ia64: fix module loading for gcc-5.4+ Sergei Trofimovich <slyfox@gentoo.org> - 2017-04-11 00:00 +0200

#1620459 — Re: [PATCH v3] ia64: fix module loading for gcc-5.4+

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-10 19:30 +0200
SubjectRe: [PATCH v3] ia64: fix module loading for gcc-5.4+
Message-ID<tuLiz-3MR-55@gated-at.bofh.it>
> +++ b/arch/ia64/kernel/module.c
> @@ -153,7 +153,7 @@ slot (const struct insn *insn)
>  static int
>  apply_imm64 (struct module *mod, struct insn *insn, uint64_t val)
>  {

I have got another idea (after your clarification) for the suggested change.


> -	if (slot(insn) != 2) {
> +	if (slot(insn) != 1 && slot(insn) != 2) {

+	int const s = slot(insn);
+	if (s < 1 || s > 2) {

Do run time characteristics matter for such a condition check here?


>  		printk(KERN_ERR "%s: invalid slot number %d for IMM64\n",

-  		       mod->name, slot(insn));
+  		       mod->name, s);


>  		return 0;


How do you think about my update suggestion for this function implementation?

Regards,
Markus

[toc] | [next] | [standalone]


#1620754

FromSergei Trofimovich <slyfox@gentoo.org>
Date2017-04-11 00:00 +0200
Message-ID<tuPvP-6qR-9@gated-at.bofh.it>
In reply to#1620459

[Multipart message — attachments visible in raw view] — view raw

On Mon, 10 Apr 2017 19:23:28 +0200
SF Markus Elfring <elfring@users.sourceforge.net> wrote:

> > -	if (slot(insn) != 2) {
> > +	if (slot(insn) != 1 && slot(insn) != 2) {  
> 
> +	int const s = slot(insn);
> +	if (s < 1 || s > 2) {
> 
> Do run time characteristics matter for such a condition check here?

It's done once at kernel module load time. My guess would be
"not critical at all".

slot() is a pure arithmetic static inline function. You can compare
assembly output before and after your change.

You can measure the difference yourself using 'ski' emulator.
That's for example how I debugged and tested the patch:
     http://trofi.github.io/posts/199-ia64-machine-emulation.html

-- 

  Sergei

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web