Skip to contentSkip to conversation

Section mismatch in parainstructions

PATCH Randy Dunlap 4 participants 6 messages Dec 10, 2006 – Dec 12, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Is it OK for section .parainstructions to reference exit.text?

I'm seeing:

WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x0)
WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x8)

If that's OK, we need a small patch to modpost, as below.

---
~Randy
From: Randy Dunlap <[email protected]>

Section .parainstructions should not warn about section mismatches.

WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x0)
WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x8)

---
 scripts/mod/modpost.c |    1 +
 1 file changed, 1 insertion(+)
scripts/mod/modpost.c +1 -0
@@ -997,6 +997,7 @@ static int exit_section_ref_ok(const cha
 		"__bug_table", /* used by powerpc for BUG() */
 		".exitcall.exit",
 		".eh_frame",
+		".parainstructions",
 		".stab",
 		"__ex_table",
 		".fixup",
#1 lore raw
Quoted 10 lines · Randy Dunlap

Is it OK for section .parainstructions to reference exit.text?

I'm seeing:

WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x0)
WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x8)

If that's OK, we need a small patch to modpost, as below.

What are the semantics of .exit.text? In principle a paravirtualized instruction can appear anywhere, so I think these warnings are bogus. The only concern is if one of these sections disappears before the paravirt_ops instruction substitution happens.

J

#2 lore raw
Quoted 9 lines · On Sun, 10 Dec 2006 16:40:53 -0800 Jeremy Fitzhardinge wrote:
Quoted 8 lines · Randy Dunlap

Is it OK for section .parainstructions to reference exit.text?

I'm seeing:

WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x0)
WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x8)

Quoted 7 lines
Quoted 2 lines

If that's OK, we need a small patch to modpost, as below.

What are the semantics of .exit.text? In principle a paravirtualized instruction can appear anywhere, so I think these warnings are bogus. The only concern is if one of these sections disappears before the paravirt_ops instruction substitution happens.

Good question. I don't see much doc on that subject. Rusty could probably answer that better than me.

Something like this:

.exit.text section(s) can be discarded from built-in (non-modular) code (or not even loaded at all).

.exit.text section(s) in modules is only loaded when CONFIG_MODULE_UNLOAD=y.

so what are the .parainstructions text sections for? Are they for replacing code instructions based on some condition(s)? (like <gag> self-modifying code? </gag>)

---
~Randy

#3 lore raw
Quoted 3 lines · Randy Dunlap

Good question. I don't see much doc on that subject. Rusty could probably answer that better than me.

Yep, it is definitely his problem, since he wrote both halves of the equation...

Quoted 5 lines

Something like this:

.exit.text section(s) can be discarded from built-in (non-modular) code (or not even loaded at all).

Quoted 7 lines

.exit.text section(s) in modules is only loaded when CONFIG_MODULE_UNLOAD=y.

so what are the .parainstructions text sections for? Are they for replacing code instructions based on some condition(s)? (like <gag> self-modifying code? </gag>)

You can compile in support for multiple paravirtualizing hypervisors (ie, Xen, VMI and/or lhype), and it will work out which backend is appropriate to use at runtime. Once it has done that, the backends have the option to patch inline code to implement simple operations (sti, for example).

So the .parainstructions section marks where there are instructions which the backend may want to replace, and the substitution happens relatively early in the kernel boot process (and on module load, I assume, but I haven't checked).

J

Acked-by
#4 lore raw
In reply to Randy Dunlap
Quoted 2 lines · Randy Dunlap

Is it OK for section .parainstructions to reference exit.text?

Yep, it can (and will) reference any section.

Quoted 8 lines

From: Randy Dunlap <[email protected]>

Section .parainstructions should not warn about section mismatches.

WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x0)
WARNING: drivers/net/hamradio/scc.o - Section mismatch: reference to .exit.text: from .parainstructions after '' (at offset 0x8)

#5 lore raw
In reply to Randy Dunlap
Quoted 3 lines · Randy Dunlap

Is it OK for section .parainstructions to reference exit.text?

Yes it's ok because

/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */

Same applies to paravirtops patching.

-Andi