Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4932405imm; Tue, 18 Sep 2018 01:21:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZmd4YvyE5TesJiifdpKw2wi3uPZiBaRL6N3A39Q+saFXYr3PLWsKYrGtdznjeH7y/z7LhW X-Received: by 2002:a62:d74b:: with SMTP id v11-v6mr1104015pfl.91.1537258869607; Tue, 18 Sep 2018 01:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537258869; cv=none; d=google.com; s=arc-20160816; b=Vev0hVb2ZovX36z2iiWxhgc8UJp8VshzRV/CJ1E0AInj9zav1MYAyEfjHxNdv5qeqd Ia9Ttbg109uCqANu/M6CRVjLQDdv4EoeNu+zN61wL6uV8cewUaGn69DT9QjC9AkXoWTX 9c8xWYHVgCn4maj5Osbg3+SQO+r4hin+3UTuSrviIPUdpoDdRdcqikl7MVXhgScFiKyo VlYJqm0KprFU+40LRF6TaWzwzpQp+loVsJpl4/a+b9ox8EQUCAnKZ4g2pIK3v3Yrki93 gOkCtKqx5WcNTzoR6cxXMvK3lXTwr6U6GWYMvD5da7pIhl27UWBExPlRafSfSdOC3p0X B20g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=b3NHlf4tlwaXHan7PZOUNKPyEn8GzuXDXyF0zdjzlbI=; b=kNaqfLHFP9mmih0yVCVikkn6eQIw8tdDoGlA5u90lAnhxJQjbinGZ3QWJblW4mJcKo IWLVuITDePhJ6CUNmGSTMjm89H4wOWwKZ55zLK4hDWK22TPSwv+mFSDHBrOGFbpKVWUb fe7A0/5HBIEJ4YonaCR53FU5414GkWMtBgB48qa7VqQRfzoau9ChIXgd7HLTO2aLdnCF Mx41Hsg/zPTQlCQUDA6/hMSLinaH8q2G9BBjQZm91OQlJyR8oacRC3WzcVnXu9OVNkyK 5MTDzHgNM1EphZ5UtwvtJvT8deswWgQT9jfpq6zLvpsbwbeSFroJh/RLtwmIL5Se4/M0 WbgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E+HVYIn4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3-v6si17800441pgk.610.2018.09.18.01.20.50; Tue, 18 Sep 2018 01:21:09 -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=pass header.i=@gmail.com header.s=20161025 header.b=E+HVYIn4; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729207AbeIRNwG (ORCPT + 99 others); Tue, 18 Sep 2018 09:52:06 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42894 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726433AbeIRNwG (ORCPT ); Tue, 18 Sep 2018 09:52:06 -0400 Received: by mail-lj1-f196.google.com with SMTP id f1-v6so922061ljc.9 for ; Tue, 18 Sep 2018 01:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=b3NHlf4tlwaXHan7PZOUNKPyEn8GzuXDXyF0zdjzlbI=; b=E+HVYIn4YfI8wRA34VEnX2yRLhLVORXq3s+MY95mYxqd6RtdzfePTXdHx++KEVkTNZ c3z8rT2H89DtlblsdhmYodnpOWE5Br4CgBJKbofxGSR/o6rOvT1quGoM8/H1E6S9R80u feWVjrGMO+715qy1lArQrhMYfnX+a9i0Bx9P5BajSm+aEH+ONDc3Uadjy0AEwvdWW+z4 7YN8wUuRqX/kyDM2Qf06/vqFgnm0fSJ1ZFVHenRi9skc9GBMCJWYC7kr3+xf9V7Lzsdk Zysn6eU+wT+JdTJhEYcZsVNj9ElPmiKhj7Us04vmDVIvWrKyjCgD3Hc4fPudXV3wRdi3 Pjuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=b3NHlf4tlwaXHan7PZOUNKPyEn8GzuXDXyF0zdjzlbI=; b=VJvVM85vj4y4iAsZ617PWu7ayquxUipaR09mJTQGP6y601K+W2dH6SrQTUhZnfgeRd FH4flOaXNwmdNJUj45H40QOwcGtqHJVPI+IO+yUgnbPO9SZCdsPmBFnxu7BU87xH7ygt HnfrRJzMZIgj7tqgd6SD+9GWre/wWaDTnMt95Ns+s5oJaTsPBGTR+JR+sAaQ7yjQYzJL Z1M8OQ7qUAjd5uDrKY9NAw72vNu81DNwVJzlNy39B2SFfilu0lJkgau6W9NVKc1bASLW +920eWXIc0q6Yhnj7RUd64tLcrKiF+VOiVz4AmGtvhW4uihrncEMs6mZxWm6ctcHYRw7 5cvA== X-Gm-Message-State: APzg51BR7Nk+q3/+4ml7hqggIs1Yw2ev0Py9WhluiR9szd7fOHVDGof4 dVLgi/Y3vqPOg+q1k0CaEx8FQl/vWptv3Mbbkns= X-Received: by 2002:a2e:4951:: with SMTP id b17-v6mr18971112ljd.31.1537258833390; Tue, 18 Sep 2018 01:20:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:5895:0:0:0:0:0 with HTTP; Tue, 18 Sep 2018 01:19:52 -0700 (PDT) In-Reply-To: <2915766.O3WEnikESX@wuerfel> References: <1455804123-2526139-1-git-send-email-arnd@arndb.de> <1455804123-2526139-3-git-send-email-arnd@arndb.de> <20160218143709.GQ19428@n2100.arm.linux.org.uk> <2915766.O3WEnikESX@wuerfel> From: Chunyan Zhang Date: Tue, 18 Sep 2018 16:19:52 +0800 Message-ID: Subject: Re: [PATCH 2/9] ARM: change NR_IPIS to 8 To: Arnd Bergmann Cc: Russell King - ARM Linux , Jon Medhurst , Daniel Thompson , Nicolas Pitre , Marc Zyngier , Ard Biesheuvel , Linux Kernel Mailing List , Linux ARM , =?UTF-8?B?T3Jzb24gWmhhaSAo57+f5LqsKQ==?= , zhaolin@spreadst.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Any conclusion on this patch? The coverity tool is still complaining error on the issue which this patch can fix. Thanks, Chunyan On 18 February 2016 at 23:18, Arnd Bergmann wrote: > On Thursday 18 February 2016 14:37:09 Russell King - ARM Linux wrote: >> On Thu, Feb 18, 2016 at 03:01:54PM +0100, Arnd Bergmann wrote: >> > When function tracing for IPIs is enabled, we get a warning for an >> > overflow of the ipi_types array with the IPI_CPU_BACKTRACE type >> > as triggered by raise_nmi(): >> > >> > arch/arm/kernel/smp.c: In function 'raise_nmi': >> > arch/arm/kernel/smp.c:489:2: error: array subscript is above array bounds [-Werror=array-bounds] >> > trace_ipi_raise(target, ipi_types[ipinr]); >> >> We really don't want to treat the backtrace IPI as a normal IPI at all - >> we want it to invoke the least amount of code possible. Hence this code >> which avoids the issue: >> >> if ((unsigned)ipinr < NR_IPI) { >> trace_ipi_entry_rcuidle(ipi_types[ipinr]); >> __inc_irq_stat(cpu, ipi_irqs[ipinr]); >> } >> >> However, what's missing is that the addition of tracing here missed >> that CPU_BACKTRACE is not to be traced. The call in raise_nmi() >> should have been converted to __smp_cross_call() to avoid the >> tracing code. > > I've replaced the patch locally with the version below now, and > will throw it into the randconfig build test infrastructure to > make sure I didn't screw up in an obvious way here. > > Arnd > > From 7528c9b0558fdf4de785e62e61f0dd2ffe874110 Mon Sep 17 00:00:00 2001 > From: Arnd Bergmann > Date: Sun, 31 Jan 2016 22:26:21 +0100 > Subject: [PATCH] ARM: prevent tracing IPI_CPU_BACKTRACE > > When function tracing for IPIs is enabled, we get a warning for an > overflow of the ipi_types array with the IPI_CPU_BACKTRACE type > as triggered by raise_nmi(): > > arch/arm/kernel/smp.c: In function 'raise_nmi': > arch/arm/kernel/smp.c:489:2: error: array subscript is above array bounds [-Werror=array-bounds] > trace_ipi_raise(target, ipi_types[ipinr]); > > This is a correct warning as we actually overflow the array here. > > This patch raise_nmi() to call __smp_cross_call() instead of > smp_cross_call(), to avoid calling into ftrace. For clarification, > I'm also adding a two new code comments describing how this one > is special. > > The warning appears to have shown up after patch e7273ff49acf > ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI"), which > changed the number assignment from '15' to '8', but as far as I can > tell has existed since the IPI tracepoints were first introduced. > If we decide to backport this patch to stable kernels, we probably > need to backport e7273ff49acf as well. > > Signed-off-by: Arnd Bergmann > Fixes: e7273ff49acf ("ARM: 8488/1: Make IPI_CPU_BACKTRACE a "non-secure" SGI") > Fixes: 365ec7b17327 ("ARM: add IPI tracepoints") # v3.17 > Signed-off-by: Arnd Bergmann > > diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h > index 3d7351c844aa..2fd0a2619b0b 100644 > --- a/arch/arm/include/asm/hardirq.h > +++ b/arch/arm/include/asm/hardirq.h > @@ -5,6 +5,7 @@ > #include > #include > > +/* number of IPIS _not_ including IPI_CPU_BACKTRACE */ > #define NR_IPI 7 > > typedef struct { > diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c > index b4048e370730..9802a94260db 100644 > --- a/arch/arm/kernel/smp.c > +++ b/arch/arm/kernel/smp.c > @@ -72,6 +72,10 @@ enum ipi_msg_type { > IPI_CPU_STOP, > IPI_IRQ_WORK, > IPI_COMPLETION, > + /* > + * CPU_BACKTRACE is special and not included in NR_IPI > + * or tracable with trace_ipi_* > + */ > IPI_CPU_BACKTRACE, > /* > * SGI8-15 can be reserved by secure firmware, and thus may > @@ -757,7 +761,7 @@ static void raise_nmi(cpumask_t *mask) > if (cpumask_test_cpu(smp_processor_id(), mask) && irqs_disabled()) > nmi_cpu_backtrace(NULL); > > - smp_cross_call(mask, IPI_CPU_BACKTRACE); > + __smp_cross_call(mask, IPI_CPU_BACKTRACE); > } > > void arch_trigger_all_cpu_backtrace(bool include_self) > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel