Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp546763ybj; Thu, 19 Sep 2019 19:02:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhG4r9freP6fkdLbz9R+vVmfZVqc3eZdKIXfjl0aHwcXPZvOZfBe0l3s3k+/Zba6O889QZ X-Received: by 2002:a17:906:3087:: with SMTP id 7mr17241327ejv.212.1568944922340; Thu, 19 Sep 2019 19:02:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568944922; cv=none; d=google.com; s=arc-20160816; b=PfDtBsKucmCACtXC7gpqGg+Pszu5mheUwpM9gmdYO0qYOsJWOW46ZqIJhRjWkSpYIe USmOTL6slWuyp2NUo0wE6JxyUqJHxjJacjqOjB2orrbeY+u8B7ik1oW4RR+5E7KXxCTZ MprbXkJ1aYH/ERcyjux3Sb238tp2R8hcZdi1Iwjq8ptcGO0pz+0BnKyIWQ29EetvYmBT 3t3po839q6X3wPczMx3EC4G5p+uZs6F8otv2tVjCy1rZv8RICTLA7fLZ83szJldzyp2O rysu1ZzQxpX8US+mnnLEjv8dbErXO+xdQVCuWirXkqpcAgXIT4XdqSpgZJGDmy5ymAOL 0jIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AQOZjwcoqaVn82G0FfSuJ2KmD6bdtToACyqb2iajctY=; b=umTmD9jbF5D2+enkjnWW3w+M5H20ZBWnSGlqOYaLVx7DLWUKLOTTyc1xDPf1frXd28 2B1BtR2/Wk2+/AOfaX+SS4b76SzWp5+3mjunIdG21G45iwo7X8oLOnO3aZWma1j0LHRG QfC/WeKUhjGgCmXec9cb23JYumeNktHHIuaYWwHY2A1ekC+NCDbxuh0Fufsmdnsg8n+k tYPLbA7Yw/0kNo5lh0Ew1QpSCOf0umGrBgFSmGWkn0XgbrH0mV4+jA/sAgOpV9KfoF1l nOkzIKbjIG9tqnQffjEZ1OqInWlWpEJSay6wj0cokQnxsxbfq6G6kFRPibS9g0QpXqZz Ix3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EHUX+BD8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si363223edr.443.2019.09.19.19.01.30; Thu, 19 Sep 2019 19:02:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EHUX+BD8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390889AbfISRbo (ORCPT + 99 others); Thu, 19 Sep 2019 13:31:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50182 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388951AbfISRbn (ORCPT ); Thu, 19 Sep 2019 13:31:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AQOZjwcoqaVn82G0FfSuJ2KmD6bdtToACyqb2iajctY=; b=EHUX+BD8HLgR7ssqxL5471sNr bQ6Q592RJERAGuxaMnsztT96IkLDOsemKT0JGHCzQPPlzkPHcCY/vymRNRmyLDCsYnqlxPZFCAR1W RV2gxMvJ7+lHyMEphrd4eHtUvuvCNiAaWxU25/X03kbI2XHEhhEW8lxrLCU8xvr+XxBFaqPMZJ07K RK8JgHLZmJSnxDqU5gRUKSdI79N4FOLqmltBXKfznZyws1dP1bo/BI6Ade+gZVuoRxFYdx4oVdjbA EqBiF7uEl/ZuJTOou8x2B6UXNcd7QSQBWIkDDbnq0JjDRLXYZ+UvBu59fjDxisUc2EYxwQuiC4JOp 9W0TVw9Aw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iB0HO-0002Lj-CC; Thu, 19 Sep 2019 17:31:42 +0000 Date: Thu, 19 Sep 2019 10:31:42 -0700 From: Christoph Hellwig To: Paul Walmsley Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: resolve most warnings from sparse Message-ID: <20190919173142.GA26224@infradead.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 19, 2019 at 01:26:38AM -0700, Paul Walmsley wrote: > > Resolve most of the warnings emitted by sparse. The objective here is > to keep arch/riscv as clean as possible with regards to sparse warnings, > and to maintain this bar for subsequent patches. I think this patch does just way to many different things and needs to be split up into one patch per issue / code module. > --- /dev/null > +++ b/arch/riscv/include/asm/entry.h For example adding this file should be a patch on its own. It can also move to arch/riscv/kernel/ instead of polluting the namespace. That being said I'm not sure I like this and the head.h patches. Just adding a header for entry points used from aseembly only seems rather pointless, I wonder if there is a way to just shut up sparse on them. Same for most of head.h. > @@ -61,6 +61,9 @@ > > #define PAGE_TABLE __pgprot(_PAGE_TABLE) > > +extern pgd_t swapper_pg_dir[]; > +extern pgd_t trampoline_pg_dir[]; > +extern pgd_t early_pg_dir[]; > extern pgd_t swapper_pg_dir[]; This seems to add a duplicate definition of swapper_pg_dir. > +extern asmlinkage void __init smp_callin(void); No nee for the extern. > index 905372d7eeb8..d0d980d99019 100644 > --- a/arch/riscv/include/asm/thread_info.h > +++ b/arch/riscv/include/asm/thread_info.h > @@ -58,6 +58,8 @@ struct thread_info { > .addr_limit = KERNEL_DS, \ > } > > +extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); This really needs to move to a header outside of arch/. Also no need for the extern and as-is this adds a line > 80 chars. > +#ifdef CONFIG_PROFILING > /* Unsupported */ > int setup_profiling_timer(unsigned int multiplier) > { > return -EINVAL; > } > +#endif Yikes. All architectures either just return 0 or -EINVAL here, and the caller has a spurious extern for it. Please just remove this arch hook and add a Kconfig variable that the few architectures currently returning 0 select insted. > +static void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, This adds an > 80 char line. > -pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE); > +static pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE); Another one. > --- a/arch/riscv/mm/sifive_l2_cache.c > +++ b/arch/riscv/mm/sifive_l2_cache.c > @@ -142,7 +142,7 @@ static irqreturn_t l2_int_handler(int irq, void *device) > return IRQ_HANDLED; > } > > -int __init sifive_l2_init(void) > +static int __init sifive_l2_init(void) > { > struct device_node *np; > struct resource res; And this needs to be applied after this file moves to the right place and isn't completely bogusly built into every RISC-V kernel. Not all the world is a SiFive..