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


Groups > linux.debian.kernel > #64904 > unrolled thread

Bug#935536: Compiling Linux with "bdver2" gcc optimization option

Started byFranco Martelli <martellif67@gmail.com>
First post2019-08-23 19:50 +0200
Last post2020-10-12 17:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.debian.kernel


Contents

  Bug#935536: Compiling Linux with "bdver2" gcc optimization option Franco Martelli <martellif67@gmail.com> - 2019-08-23 19:50 +0200
    Bug#935536: Fwd: Compiling Linux with "bdver2" gcc optimization option Franco Martelli <martellif67@gmail.com> - 2020-10-12 17:20 +0200

#64904 — Bug#935536: Compiling Linux with "bdver2" gcc optimization option

FromFranco Martelli <martellif67@gmail.com>
Date2019-08-23 19:50 +0200
SubjectBug#935536: Compiling Linux with "bdver2" gcc optimization option
Message-ID<yylRf-6uY-3@gated-at.bofh.it>
Package: linux-kbuild-4.19
Version: 4.19.37-5+deb10u2

In order to achieve Linux kernel optimized for my CPU AMD FX-8350
Bulldozer2 I changed the "Processor family" to
"Opteron/Athlon64/Hammer/K8" under "Processor type and features" menu of
the configuration program of the kernel (make menuconfig). Then I
changed line 121 of linux-source-4.19/arch/x86/Makefile
from:

cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)

to:

cflags-$(CONFIG_MK8) += $(call cc-option,-march=bdver2) \
<Tab>	<Tab>	$(call cc-option,-mtune=bdver2,$(call
cc-option,-mtune=generic))

compiling the kernel up to Debian 9.x Stretch all worked fine but with
Debian 10 Buster I get a lot of warning messages:

~/linux-source-4.19$ time make -s -j9 ; make -s -j9 modules
<snip>
mm/memory.o: warning: objtool: remap_pfn_range()+0xd5: unsupported
intra-function call
mm/memory.o: warning: objtool: If this is a retpoline, please patch it
in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE.
mm/mlock.o: warning: objtool: __munlock_isolate_lru_page()+0xd6: stack
state mismatch: cfa1=7+64 cfa2=7+56
mm/mlock.o: warning: objtool: clear_page_mlock()+0x39: unsupported
instruction in callable function
mm/mlock.o: warning: objtool: mlock_vma_page()+0x8e: sibling call from
callable instruction with modified stack frame
mm/mlock.o: warning: objtool: munlock_vma_page()+0x163: return with
modified stack frame
kernel/bpf/stackmap.o: warning: objtool: bpf_get_stack()+0x68: return
with modified stack frame
kernel/bpf/sockmap.o: warning: objtool: bpf_exec_tx_verdict()+0x436:
stack state mismatch: cfa1=7+168 cfa2=7+160
kernel/power/qos.o: warning: objtool: pm_qos_remove_request()+0x6d:
return with modified stack frame
arch/x86/kernel/dumpstack.o: warning: objtool: __die()+0xc2: return with
modified stack frame
arch/x86/kernel/cpu/amd.o: warning: objtool: bsp_init_amd()+0xb1: can't
find jump dest instruction at .text+0x193
arch/x86/kvm/x86.o: warning: objtool: kvm_set_cr3()+0x18: can't find
jump dest instruction at .text+0x5cc0
arch/x86/kernel/ldt.o: warning: objtool: write_ldt()+0x110: can't find
jump dest instruction at .text+0x56a
mm/mmap.o: warning: objtool: init_user_reserve()+0x34: return with
modified stack frame
mm/mmap.o: warning: objtool: init_admin_reserve()+0x34: return with
modified stack frame
mm/mmap.o: warning: objtool: vm_brk_flags()+0x55: stack state mismatch:
cfa1=7+80 cfa2=7+72
mm/mmap.o: warning: objtool: do_mmap()+0x1bf: stack state mismatch:
cfa1=7+80 cfa2=7+72
mm/mprotect.o: warning: objtool: change_protection()+0x4f5: can't find
jump dest instruction at .text+0x5a3
mm/mremap.o: warning: objtool: move_page_tables()+0x60: stack state
mismatch: cfa1=7+144 cfa2=7+136
mm/mremap.o: warning: objtool: __se_sys_mremap()+0x12d: stack state
mismatch: cfa1=7+160 cfa2=7+152
arch/x86/kernel/sys_x86_64.o: warning: objtool: get_align_mask()+0x1d:
can't find jump dest instruction at .text+0x2f
mm/page_vma_mapped.o: warning: objtool: check_pte()+0x108: return with
modified stack frame
mm/page_vma_mapped.o: warning: objtool: page_vma_mapped_walk()+0x15e:
stack state mismatch: cfa1=7+56 cfa2=7+40
mm/pagewalk.o: warning: objtool: __walk_page_range()+0x1be: return with
modified stack frame
kernel/printk/printk.o: warning: objtool: devkmsg_write.cold.15()+0x30:
can't find jump dest instruction at .text.unlikely+0x2a1
arch/x86/kvm/emulate.o: warning: objtool: rsm_load_state_32()+0x2e2:
can't find jump dest instruction at .text+0xfa4
arch/x86/kvm/i8254.o: warning: objtool: pit_ioport_read()+0x141: can't
find jump dest instruction at .text+0x7cb
arch/x86/kvm/mmu.o: warning: objtool:
kvm_calc_tdp_mmu_root_page_role()+0xb: can't find jump dest instruction
at .text+0x3fd
arch/x86/kvm/lapic.o: warning: objtool: recalculate_apic_map()+0x2f6:
can't find jump dest instruction at .text+0x968
mm/rmap.o: warning: objtool: try_to_unmap_one()+0x4d1: can't find jump
dest instruction at .text+0x185b
arch/x86/kvm/ioapic.o: warning: objtool:
rtc_irq_eoi_tracking_reset()+0x45: return with modified stack frame
arch/x86/kvm/ioapic.o: warning: objtool: ioapic_mmio_write()+0x62: stack
state mismatch: cfa1=7+48 cfa2=7+40
arch/x86/kvm/ioapic.o: warning: objtool: ioapic_mmio_read()+0xe5: stack
state mismatch: cfa1=7+64 cfa2=7+56
arch/x86/kvm/ioapic.o: warning: objtool: kvm_get_ioapic()+0x72: return
with modified stack frame
arch/x86/kvm/ioapic.o: warning: objtool: kvm_set_ioapic()+0x105: return
with modified stack frame
arch/x86/kvm/irq_comm.o: warning: objtool: kvm_set_msi_irq()+0x60:
return with modified stack frame
kernel/rcu/sync.o: warning: objtool: rcu_sync_init()+0x52: return with
modified stack frame
mm/vmalloc.o: warning: objtool: vmalloc_to_page()+0x150: return with
modified stack frame
mm/vmalloc.o: warning: objtool: vunmap_page_range()+0x2fc: return with
modified stack frame
mm/vmalloc.o: warning: objtool: vm_unmap_ram()+0x11f: sibling call from
callable instruction with modified stack frame
mm/vmalloc.o: warning: objtool: vmap_page_range_noflush()+0x2ec: return
with modified stack frame
mm/vmalloc.o: warning: objtool: vread()+0x1cf: stack state mismatch:
cfa1=7+96 cfa2=7+88
mm/vmalloc.o: warning: objtool: vwrite()+0x176: stack state mismatch:
cfa1=7+96 cfa2=7+88
arch/x86/kvm/cpuid.o: warning: objtool: do_cpuid_ent()+0x6b4: can't find
jump dest instruction at .text+0xba6
arch/x86/kvm/pmu.o: warning: objtool: reprogram_fixed_counter()+0xbb:
can't find jump dest instruction at .text+0x37d
kernel/rcu/srcutree.o: warning: objtool: process_srcu()+0x50: stack
state mismatch: cfa1=7+128 cfa2=7+120
kernel/rcu/srcutree.o: warning: objtool: __call_srcu()+0xba: sibling
call from callable instruction with modified stack frame
arch/x86/kernel/alternative.o: warning: objtool:
apply_alternatives()+0x10f: stack state mismatch: cfa1=7+336 cfa2=7+328
arch/x86/kernel/alternative.o: warning: objtool: apply_paravirt()+0x118:
stack state mismatch: cfa1=7+296 cfa2=7+288
arch/x86/kvm/hyperv.o: warning: objtool:
kvm_hv_notify_acked_sint()+0x4a: can't find jump dest instruction at
.text+0x20c
mm/madvise.o: warning: objtool: swapin_walk_pmd_entry()+0x1ec: stack
state mismatch: cfa1=7+88 cfa2=7+80
mm/madvise.o: warning: objtool: madvise_free_pte_range()+0x39e: stack
state mismatch: cfa1=7+136 cfa2=7+128
arch/x86/kernel/tsc_msr.o: warning: objtool: cpu_khz_from_msr()+0x99:
can't find jump dest instruction at .text+0x36
kernel/rcu/tree.o: warning: objtool: rcu_exp_wait_wake()+0x224: return
with modified stack frame
kernel/rcu/tree.o: warning: objtool:
_synchronize_rcu_expedited.constprop.55()+0x1c7: stack state mismatch:
cfa1=7+192 cfa2=7+184
arch/x86/kernel/tsc.o: warning: objtool:
pit_hpet_ptimer_calibrate_cpu()+0x1c4: stack state mismatch: cfa1=7+112
cfa2=7+104
arch/x86/kernel/tsc.o: warning: objtool:
tsc_refine_calibration_work()+0xd8: stack state mismatch: cfa1=7+48
cfa2=7+40
</snip>

I guess that objtool has stopped recognize CPU instructions for
-march=bdver2 gcc optimization flag. The only workaround I know it is to
use -march=bdver1 instead this compiles without warnings.
Is there a way to get the kernel optimized for my CPU as it happened in
all the previous Debian versions?

Kind regards
-- 
Franco Martelli

[toc] | [next] | [standalone]


#68368 — Bug#935536: Fwd: Compiling Linux with "bdver2" gcc optimization option

FromFranco Martelli <martellif67@gmail.com>
Date2020-10-12 17:20 +0200
SubjectBug#935536: Fwd: Compiling Linux with "bdver2" gcc optimization option
Message-ID<AZ7Md-31M-1@gated-at.bofh.it>
In reply to#64904
The Objtools maintainer told me to ignore the warnings unless live
patching it's used. This probably it means "Won't Fix" status to this
bug report, however if some kernel hacker will want to fix it I would be
so glad to see those warnings go away.


-------- Messaggio Inoltrato --------
Oggetto: Re: Compiling Linux with "bdver2" gcc optimization option
Data: Thu, 8 Oct 2020 11:24:01 -0500
Mittente: Josh Poimboeuf <jpoimboe@redhat.com>
A: Franco Martelli <martellif67@gmail.com>
CC: peterz@infradead.org

On Thu, Oct 08, 2020 at 06:00:41PM +0200, Franco Martelli wrote:
> Hello dear Objtools Maintainers,
> 
> I got your email address by running the command:
> 
> ~/linux-source-5.8$ perl scripts/get_maintainer.pl -f
> tools/objtool/objtool.c
> 
> from long time I optimize Linux kernel builds using the "bdver2" GCC
> optimization option but sadly it doesn't work anymore. I don't know from
> which Linux kernel version up to now the bug appeared.
> I submitted this bug report [1] to the Debian BTS. I would ask if you
> could pay yours attention and fix it.
> Should I submit the bug report also to https://bugzilla.kernel.org ?
> 
> Thank you very much for yours patience, best regards.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935536

Hi Franco,

It will be difficult for objtool to support all the tuning options,
especially since they're so rarely used.  If you don't use live
patching, it's probably safe to ignore the warnings.

-- 
Josh

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web