Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2208050rdb; Thu, 21 Sep 2023 11:29:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGOeg/pOGx48LZOq7uAcqev3H3j/WCDmqsq8YUxskeleeADTflBXHUfKZNuQBJBrZknKXjl X-Received: by 2002:a05:6359:4f05:b0:143:6816:7ed0 with SMTP id nf5-20020a0563594f0500b0014368167ed0mr9788523rwb.0.1695320998781; Thu, 21 Sep 2023 11:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695320998; cv=none; d=google.com; s=arc-20160816; b=CBiO6WV1ltXLcIwKw0f62dHioy7EUGNkI25kPJqnhpFrYm6uiDPvm+MEGzmCv7xqma RmqlYtGpRXyN6MBlk9FEo2cGidKZAd7I6/FFzXFhtBNRMWKxl50G1kEA3+3aCuKZCGc6 HUrVbLSDyq65IlZGUCU2twaiM8yPzRqm5QIkkW2l8PSGhCEENdciLjybZBTEXTTM3p/t ehurBIGttu4CGj67/8p8fLyLoHX8rFV7oUMD4kLzAXK3cV45PmXs3ZZacjJEG6ziz0bn PRWMVF94dq+onpxXM2T+l2XW1H4cFbiRReRqs356ki5l2B9UDwkQE9WfWD4vqbudQG32 rG+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jgc5OC4whabJUYgUdeeZ9owtv/v9oLP+r0hDLmpuUp8=; fh=NemyO3ONVvgWw2SKk8HShH6M5gmMde9MX5x8AKu8nAs=; b=J60Zg+EPXnmEFeIdFa8oLnhmZi9JQMIfw8kotJJx7MpcgtIPEyeMc5SNcFzEFCya04 ekZz/PXOVWbq5pRAMtE96Yb5sxVtcSA2f2CmIDnCvtOFeQOGDwkxXK2Fpo0lqJoJXt+Z bS5845loAY7SNnnd+oS29YLCzxlDBAsLVT3ZwvCdLSOwgaJq+Gc4QT5eStKwnfnvG8rK aEdsnRb8Goly0iRvM50Br4ckwe3U72A39jg24SLUcEy5BdC/OVD4oqLvDAnmQKVEHcVB GWj9M5E0Pb5Z/4iSIz6/a9naJqVGC2cWAqjoH56ZO+mwZlZQdc2w4aSixlrik3NXL1Q2 ebig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F9Vi0M1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 26-20020a63155a000000b00578e29ae274si1888193pgv.521.2023.09.21.11.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 11:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F9Vi0M1Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6B8FD82BB571; Thu, 21 Sep 2023 11:15:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbjIUSPD (ORCPT + 99 others); Thu, 21 Sep 2023 14:15:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjIUSO6 (ORCPT ); Thu, 21 Sep 2023 14:14:58 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 343217B455 for ; Thu, 21 Sep 2023 10:37:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B934DC433AB for ; Thu, 21 Sep 2023 07:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695279913; bh=7Df8txX6tNh8+z8O5qnNPlJhaZR/jAFhkKBaNPawCzs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=F9Vi0M1ZsDsklANl78Xa6ScOHr6g1CIdNmo7AS65q5i3Wqe5CXuwybAEC65EqagUC zDJe2/Ca52cD4TOdb9ZmFHN3b9vhl9yu9U9/BN1tZKG8xydznEZAUbGHPG5/uLt4tv JOGsA0T/nFT2UbACt9pJtJ/v7yCzwPtNskC/Rfe22wbFv6rIkgzKuAvR3HJ2EgbHNM 9Bn5Ec9uWyEdyys2sRfxAPW891MZINBjZQDzydLSqSYDvQelznzvQXU0Dqr2nEWBSo vVfgFg3LfPdF1Dgj0aM2LD2JtZAuuhOuas69oyPR5waOYj5YIP8xcXYJcBd5BdkIEi 9zAOSauRVO4bA== Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-9ae22bf33a0so386389666b.0 for ; Thu, 21 Sep 2023 00:05:13 -0700 (PDT) X-Gm-Message-State: AOJu0Yz316t2LZDXNjM0XmC4tzSYhLFPo1WBtaoCO8qJOoHoUfyBIM9N fyifAH9EDQ6Xe5/x1WL4SJeHLC1Ll31PL15kdKw= X-Received: by 2002:a17:907:3f8c:b0:9ad:f17a:c712 with SMTP id hr12-20020a1709073f8c00b009adf17ac712mr12245452ejc.25.1695279912013; Thu, 21 Sep 2023 00:05:12 -0700 (PDT) MIME-Version: 1.0 References: <20230920032810.1392548-1-maobibo@loongson.cn> In-Reply-To: <20230920032810.1392548-1-maobibo@loongson.cn> From: Huacai Chen Date: Thu, 21 Sep 2023 15:04:59 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] LoongArch: Fix some build warnings with W=1 option To: Bibo Mao Cc: Xi Ruoyao , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:15:06 -0700 (PDT) Hi, Bibo, I applied this patch with even more fixes: https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson.g= it/commit/?h=3Dloongarch-next&id=3Dc718a0bad75ccef117000223b00fd6a14f849135 Huacai On Wed, Sep 20, 2023 at 11:28=E2=80=AFAM Bibo Mao wro= te: > > There are some building warnings when building LoongArch kernel > with W=3D1 option as following, this patch fixes these building > warnings. > > arch/loongarch/kernel/traps.c:496:25: warning: no previous prototype > for 'do_fpe' [-Wmissing-prototypes] > 496 | asmlinkage void noinstr do_fpe(struct pt_regs *regs > | ^~~~~~ > arch/loongarch/kernel/syscall.c:21:40: warning: initialized field > overwritten [-Woverride-init] > 21 | #define __SYSCALL(nr, call) [nr] =3D (call), > | ^ > > Signed-off-by: Bibo Mao > --- > Changes in v2: > 1. Remove modification about file arch/loongarch/kernel/asm-offsets.c, > since it is refacted now. > 2. Add more modification and eliminate almost all building warnings in > arch/loongarch tree. > --- > arch/loongarch/include/asm/exception.h | 26 ++++++++++++++++++++++++++ > arch/loongarch/include/asm/io.h | 4 +--- > arch/loongarch/include/asm/smp.h | 1 + > arch/loongarch/include/asm/syscall.h | 1 + > arch/loongarch/kernel/Makefile | 1 + > arch/loongarch/kernel/process.c | 1 + > arch/loongarch/kernel/signal.c | 6 +++--- > arch/loongarch/kernel/smp.c | 3 +++ > arch/loongarch/kernel/syscall.c | 1 + > arch/loongarch/kernel/time.c | 2 +- > arch/loongarch/kernel/traps.c | 10 ++++++---- > arch/loongarch/mm/fault.c | 1 + > arch/loongarch/mm/tlb.c | 2 +- > 13 files changed, 47 insertions(+), 12 deletions(-) > create mode 100644 arch/loongarch/include/asm/exception.h > > diff --git a/arch/loongarch/include/asm/exception.h b/arch/loongarch/incl= ude/asm/exception.h > new file mode 100644 > index 000000000000..ffa068aa6ac9 > --- /dev/null > +++ b/arch/loongarch/include/asm/exception.h > @@ -0,0 +1,26 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > + > +#ifndef __ASM_EXCEPTION_H > +#define __ASM_EXCEPTION_H > + > +#include > + > +asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr)= ; > +asmlinkage void noinstr do_ade(struct pt_regs *regs); > +asmlinkage void noinstr do_ale(struct pt_regs *regs); > +asmlinkage void noinstr do_bce(struct pt_regs *regs); > +asmlinkage void noinstr do_bp(struct pt_regs *regs); > +asmlinkage void noinstr do_watch(struct pt_regs *regs); > +asmlinkage void noinstr do_ri(struct pt_regs *regs); > +asmlinkage void noinstr do_fpu(struct pt_regs *regs); > +asmlinkage void noinstr do_lsx(struct pt_regs *regs); > +asmlinkage void noinstr do_lasx(struct pt_regs *regs); > +asmlinkage void noinstr do_lbt(struct pt_regs *regs); > +asmlinkage void noinstr do_reserved(struct pt_regs *regs); > +asmlinkage void cache_parity_error(void); > +asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs); > +asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp); > +asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, > + unsigned long write, unsigned long addres= s); > + > +#endif /* __ASM_EXCEPTION_H */ > diff --git a/arch/loongarch/include/asm/io.h b/arch/loongarch/include/asm= /io.h > index 0dcb36b32cb2..58bc88c5a9e5 100644 > --- a/arch/loongarch/include/asm/io.h > +++ b/arch/loongarch/include/asm/io.h > @@ -10,6 +10,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -19,9 +20,6 @@ > */ > #define page_to_phys(page) ((phys_addr_t)page_to_pfn(page) << PAGE_S= HIFT) > > -extern void __init __iomem *early_ioremap(u64 phys_addr, unsigned long s= ize); > -extern void __init early_iounmap(void __iomem *addr, unsigned long size)= ; > - > #define early_memremap early_ioremap > #define early_memunmap early_iounmap > > diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/as= m/smp.h > index 66ecb480c894..a845ed3a6456 100644 > --- a/arch/loongarch/include/asm/smp.h > +++ b/arch/loongarch/include/asm/smp.h > @@ -19,6 +19,7 @@ extern cpumask_t cpu_sibling_map[]; > extern cpumask_t cpu_core_map[]; > extern cpumask_t cpu_foreign_map[]; > > +asmlinkage void start_secondary(void); > void loongson_smp_setup(void); > void loongson_prepare_cpus(unsigned int max_cpus); > void loongson_boot_secondary(int cpu, struct task_struct *idle); > diff --git a/arch/loongarch/include/asm/syscall.h b/arch/loongarch/includ= e/asm/syscall.h > index e286dc58476e..089a58d2a45f 100644 > --- a/arch/loongarch/include/asm/syscall.h > +++ b/arch/loongarch/include/asm/syscall.h > @@ -20,6 +20,7 @@ > > extern void *sys_call_table[]; > > +void noinstr do_syscall(struct pt_regs *regs); > static inline long syscall_get_nr(struct task_struct *task, > struct pt_regs *regs) > { > diff --git a/arch/loongarch/kernel/Makefile b/arch/loongarch/kernel/Makef= ile > index c56ea0b75448..1e94764005e1 100644 > --- a/arch/loongarch/kernel/Makefile > +++ b/arch/loongarch/kernel/Makefile > @@ -19,6 +19,7 @@ obj-$(CONFIG_CPU_HAS_LBT) +=3D lbt.o > > obj-$(CONFIG_ARCH_STRICT_ALIGN) +=3D unaligned.o > > +CFLAGS_syscall.o +=3D $(call cc-option,-Wno-override-init,) > ifdef CONFIG_FUNCTION_TRACER > ifndef CONFIG_DYNAMIC_FTRACE > obj-y +=3D mcount.o ftrace.o > diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/proc= ess.c > index 3cb082e0c992..767d94cce0de 100644 > --- a/arch/loongarch/kernel/process.c > +++ b/arch/loongarch/kernel/process.c > @@ -37,6 +37,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/arch/loongarch/kernel/signal.c b/arch/loongarch/kernel/signa= l.c > index 504fdfe85203..aa482eae5e79 100644 > --- a/arch/loongarch/kernel/signal.c > +++ b/arch/loongarch/kernel/signal.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -891,7 +892,7 @@ static unsigned long setup_extcontext(struct extctx_l= ayout *extctx, unsigned lon > return new_sp; > } > > -void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, > +static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *r= egs, > struct extctx_layout *extctx) > { > unsigned long sp; > @@ -921,8 +922,7 @@ void __user *get_sigframe(struct ksignal *ksig, struc= t pt_regs *regs, > /* > * Atomically swap in the new signal mask, and wait for a signal. > */ > - > -asmlinkage long sys_rt_sigreturn(void) > +SYSCALL_DEFINE0(rt_sigreturn) > { > int sig; > sigset_t set; > diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c > index 6667b0a90f81..ef35c871244f 100644 > --- a/arch/loongarch/kernel/smp.c > +++ b/arch/loongarch/kernel/smp.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -556,10 +557,12 @@ void smp_send_stop(void) > smp_call_function(stop_this_cpu, NULL, 0); > } > > +#ifdef CONFIG_PROFILING > int setup_profiling_timer(unsigned int multiplier) > { > return 0; > } > +#endif > > static void flush_tlb_all_ipi(void *info) > { > diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/sysc= all.c > index 3fc4211db989..b73218ce55e8 100644 > --- a/arch/loongarch/kernel/syscall.c > +++ b/arch/loongarch/kernel/syscall.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > > #undef __SYSCALL > diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c > index c189e03cd5da..3064af94db9c 100644 > --- a/arch/loongarch/kernel/time.c > +++ b/arch/loongarch/kernel/time.c > @@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_d= evice *dev) > { > } > > -irqreturn_t constant_timer_interrupt(int irq, void *data) > +static irqreturn_t constant_timer_interrupt(int irq, void *data) > { > int cpu =3D smp_processor_id(); > struct clock_event_device *cd; > diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.= c > index 65214774ef7c..e6429047b6d9 100644 > --- a/arch/loongarch/kernel/traps.c > +++ b/arch/loongarch/kernel/traps.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -371,7 +372,7 @@ void show_regs(struct pt_regs *regs) > dump_stack(); > } > > -void show_registers(struct pt_regs *regs) > +static void show_registers(struct pt_regs *regs) > { > __show_regs(regs); > print_modules(); > @@ -439,7 +440,7 @@ static inline void setup_vint_size(unsigned int size) > * happen together with Overflow or Underflow, and `ptrace' can set > * any bits. > */ > -void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, > +static void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, > struct task_struct *tsk) > { > int si_code =3D FPE_FLTUNK; > @@ -458,7 +459,8 @@ void force_fcsr_sig(unsigned long fcsr, void __user *= fault_addr, > force_sig_fault(SIGFPE, si_code, fault_addr); > } > > -int process_fpemu_return(int sig, void __user *fault_addr, unsigned long= fcsr) > +static int process_fpemu_return(int sig, void __user *fault_addr, > + unsigned long fcsr) > { > int si_code; > > @@ -824,7 +826,7 @@ asmlinkage void noinstr do_watch(struct pt_regs *regs= ) > asmlinkage void noinstr do_ri(struct pt_regs *regs) > { > int status =3D SIGILL; > - unsigned int opcode =3D 0; > + unsigned int __maybe_unused opcode; > unsigned int __user *era =3D (unsigned int __user *)exception_era= (regs); > irqentry_state_t state =3D irqentry_enter(regs); > > diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c > index e6376e3dce86..02f2a9765524 100644 > --- a/arch/loongarch/mm/fault.c > +++ b/arch/loongarch/mm/fault.c > @@ -26,6 +26,7 @@ > #include > > #include > +#include > #include > #include > > diff --git a/arch/loongarch/mm/tlb.c b/arch/loongarch/mm/tlb.c > index eb8572e201ea..2c0a411f23aa 100644 > --- a/arch/loongarch/mm/tlb.c > +++ b/arch/loongarch/mm/tlb.c > @@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS]; > #endif > extern long exception_handlers[VECSIZE * 128 / sizeof(long)]; > > -void setup_tlb_handler(int cpu) > +static void setup_tlb_handler(int cpu) > { > setup_ptwalker(); > local_flush_tlb_all(); > > base-commit: 9fdfb15a3dbf818e06be514f4abbfc071004cbe7 > -- > 2.27.0 >