Commit 0dafe996 authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik
Browse files

s390: Use inline qualifier for all EX_TABLE and ALTERNATIVE inline assemblies



Use asm_inline for all inline assemblies which make use of the EX_TABLE or
ALTERNATIVE macros.

These macros expand to many lines and the compiler assumes the number of
lines within an inline assembly is the same as the number of instructions
within an inline assembly. This has an effect on inlining and loop
unrolling decisions.

In order to avoid incorrect assumptions use asm_inline, which tells the
compiler that an inline assembly has the smallest possible size.

In order to avoid confusion when asm_inline should be used or not, since a
couple of inline assemblies are quite large: the rule is to always use
asm_inline whenever the EX_TABLE or ALTERNATIVE macro is used. In specific
cases there may be reasons to not follow this guideline, but that should
be documented with the corresponding code.

Using the inline qualifier everywhere has only a small effect on the kernel
image size:

add/remove: 0/10 grow/shrink: 19/8 up/down: 1492/-1858 (-366)

The only location where this seems to matter is load_unaligned_zeropad()
from word-at-a-time.h where the compiler inlines more functions within the
dcache code, which is indeed code where performance matters.

Suggested-by: default avatarJuergen Christ <jchrist@linux.ibm.com>
Reviewed-by: default avatarJuergen Christ <jchrist@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent caa3cd5c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ static inline int __diag308(unsigned long subcode, void *addr)
{
	union register_pair r1 = { .even = (unsigned long)addr, .odd = 0 };

	asm volatile(
	asm_inline volatile(
		"	diag	%[r1],%[subcode],0x308\n"
		"0:\n"
		EX_TABLE(0b, 0b)
+3 −3
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
	rx.odd	= rx2;
	ry = 0x10; /* storage configuration */
	exception = 1;
	asm volatile(
	asm_inline volatile(
		"	diag	%[rx],%[ry],0x260\n"
		"0:	lhi	%[exc],0\n"
		"1:\n"
@@ -105,7 +105,7 @@ static int diag500_storage_limit(unsigned long *max_physmem_end)
{
	unsigned long storage_limit;

	asm volatile(
	asm_inline volatile(
		"	lghi	%%r1,%[subcode]\n"
		"	lghi	%%r2,0\n"
		"	diag	%%r2,%%r4,0x500\n"
@@ -126,7 +126,7 @@ static int tprot(unsigned long addr)
	int cc, exception;

	exception = 1;
	asm volatile(
	asm_inline volatile(
		"	tprot	0(%[addr]),0\n"
		"0:	lhi	%[exc],0\n"
		"1:\n"
+2 −2
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ static void detect_diag9c(void)
	int rc = 1;

	cpu = stap();
	asm volatile(
	asm_inline volatile(
		"	diag	%[cpu],%%r0,0x9c\n"
		"0:	lhi	%[rc],0\n"
		"1:\n"
@@ -138,7 +138,7 @@ static int cmma_test_essa(void)
	int rc = 1;

	/* Test ESSA_GET_STATE */
	asm volatile(
	asm_inline volatile(
		"	.insn	rrf,0xb9ab0000,%[tmp],%[tmp],%[cmd],0\n"
		"0:	lhi	%[rc],0\n"
		"1:\n"
+3 −3
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ static inline int qctri(struct cpumf_ctr_info *info)
{
	int rc = -EINVAL;

	asm volatile (
	asm_inline volatile (
		"0:	qctri	%1\n"
		"1:	lhi	%0,0\n"
		"2:\n"
@@ -185,7 +185,7 @@ static inline int lcctl(u64 ctl)
{
	int cc;

	asm volatile (
	asm_inline volatile (
		"	lcctl	%[ctl]\n"
		CC_IPM(cc)
		: CC_OUT(cc, cc)
@@ -200,7 +200,7 @@ static inline int __ecctr(u64 ctr, u64 *content)
	u64 _content;
	int cc;

	asm volatile (
	asm_inline volatile (
		"	ecctr	%[_content],%[ctr]\n"
		CC_IPM(cc)
		: CC_OUT(cc, cc), [_content] "=d" (_content)
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static inline void diag10_range(unsigned long start_pfn, unsigned long num_pfn)
	end_addr = pfn_to_phys(start_pfn + num_pfn - 1);

	diag_stat_inc(DIAG_STAT_X010);
	asm volatile(
	asm_inline volatile(
		"0:	diag	%0,%1,0x10\n"
		"1:	nopr	%%r7\n"
		EX_TABLE(0b, 1b)
Loading