Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp941120imm; Wed, 25 Jul 2018 08:43:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcmm9199I4y0jlI3ZOSOo7mpjMJp+5CURsy6tO7e3n7AFw8M0LXu6HtnSyPz4XvtVTmEhRn X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr22641219pfo.82.1532533418504; Wed, 25 Jul 2018 08:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532533418; cv=none; d=google.com; s=arc-20160816; b=Kb2TW4cft5iLg//ITmtPcq9/x1EMsKpDvR8rniRV/Krqw1PGdBSACDEXAJt02u5xUq 0PWREdm4kQItMvNiFBslasBDl+MGoQ9E8V8DbKlNfZ726eeFk2A9+mbn50SRbtLtgO6N QJ/mVVPuDmsLni6Rhijr8i0zAMqLJwHDs3Gj7drYk7F5CexmBbkvyWWV8yiSUjQFKdbz UYPHhWnO2WrdknXlRPvXwhP9/dDArJ3y85fM5unUlO6QhUHx7PqAbUYxTkT1pHYjKosb 66rfwbd0xcupF6tQGyzEV1pT7h3KOXOQypm6guAktilmUumVR29PeS6bccrpcWQYuIG4 FbSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-disposition:mime-version:user-agent:in-reply-to:references :subject:cc:to:from:message-id:date:arc-authentication-results; bh=4P7dramQ5rCJCvXHwy70Pwj0eAn7VFtwhYXAcmPcWjg=; b=eBAnZTDMB4h8DfBCaxHDuQ24x9la1Fbadx4DmvgtT+zAIS1X8t9Od/813aFK+FiYB0 iwD05sl3yfppLEA6xymubY3plykk8JypkQpc6C8MXHPZIbYpkE4HjK2OniDOiBexStRq 9/9I87l6h6F34Lkznx9pncTFbu9/A0WiIPe0Zn6rZv6wE7C0RiJRqEv6ZpgJKxthM3Bw amfMZbdiyT0AdjNa13WII5i95UMo6XFWrQre61ssZej7J41SQDAK8Xg8oHh7NqdL1IUn W90P+/gZWP4J+lGoNoiYDBM+RWGq37gmsHB1ncTlbO0wCYlUUfIMaUJ1gbpyb48hjdMQ KZkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 b2-v6si15135136plm.202.2018.07.25.08.43.23; Wed, 25 Jul 2018 08:43:38 -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; 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 S1728620AbeGYQyn convert rfc822-to-8bit (ORCPT + 99 others); Wed, 25 Jul 2018 12:54:43 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:8367 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728436AbeGYQyn (ORCPT ); Wed, 25 Jul 2018 12:54:43 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 41bKH9273sz9ty7H; Wed, 25 Jul 2018 17:42:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 4ikm6VBsBF6w; Wed, 25 Jul 2018 17:42:29 +0200 (CEST) Received: from vm-hermes.si.c-s.fr (vm-hermes.si.c-s.fr [192.168.25.253]) by pegase1.c-s.fr (Postfix) with ESMTP id 41bKH91Ym5z9ty76; Wed, 25 Jul 2018 17:42:29 +0200 (CEST) Received: by vm-hermes.si.c-s.fr (Postfix, from userid 33) id 1E352781; Wed, 25 Jul 2018 17:42:28 +0200 (CEST) Received: from 37.173.118.119 ([37.173.118.119]) by messagerie.si.c-s.fr (Horde Framework) with HTTP; Wed, 25 Jul 2018 17:42:28 +0200 Date: Wed, 25 Jul 2018 17:42:28 +0200 Message-ID: <20180725174228.Horde.-PsCOyKHj9skAHIMbqyLDg1@messagerie.si.c-s.fr> From: LEROY Christophe To: Murilo Opsfelder Araujo Cc: linuxppc-dev@lists.ozlabs.org, "Tobin C . Harding" , Sukadev Bhattiprolu , Simon Guo , Paul Mackerras , Nicholas Piggin , Michael Neuling , Michael Ellerman , "Eric W . Biederman" , Cyril Bur , Benjamin Herrenschmidt , Balbir Singh , Andrew Donnellan , Alastair D'Silva , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/7] powerpc/traps: Return early in show_signal_msg() References: <20180724192720.32417-1-muriloo@linux.ibm.com> <20180724192720.32417-3-muriloo@linux.ibm.com> In-Reply-To: <20180724192720.32417-3-muriloo@linux.ibm.com> User-Agent: Internet Messaging Program (IMP) H5 (6.2.3) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Murilo Opsfelder Araujo a écrit : > Modify logic of show_signal_msg() to return early, if possible. Replace > printk_ratelimited() by printk() and a default rate limit burst to limit > displaying unhandled signals messages. Can you explain more the benefits of this change ? Christophe > > Signed-off-by: Murilo Opsfelder Araujo > --- > arch/powerpc/kernel/traps.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c > index cbd3dc365193..4faab4705774 100644 > --- a/arch/powerpc/kernel/traps.c > +++ b/arch/powerpc/kernel/traps.c > @@ -301,6 +301,13 @@ void user_single_step_siginfo(struct task_struct *tsk, > info->si_addr = (void __user *)regs->nip; > } > > +static bool show_unhandled_signals_ratelimited(void) > +{ > + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, > + DEFAULT_RATELIMIT_BURST); > + return show_unhandled_signals && __ratelimit(&rs); > +} > + > static void show_signal_msg(int signr, struct pt_regs *regs, int code, > unsigned long addr) > { > @@ -309,11 +316,12 @@ static void show_signal_msg(int signr, struct > pt_regs *regs, int code, > const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \ > "at %016lx nip %016lx lr %016lx code %x\n"; > > - if (show_unhandled_signals && unhandled_signal(current, signr)) { > - printk_ratelimited(regs->msr & MSR_64BIT ? fmt64 : fmt32, > - current->comm, current->pid, signr, > - addr, regs->nip, regs->link, code); > - } > + if (!unhandled_signal(current, signr)) > + return; > + > + printk(regs->msr & MSR_64BIT ? fmt64 : fmt32, > + current->comm, current->pid, signr, > + addr, regs->nip, regs->link, code); > } > > void _exception_pkey(int signr, struct pt_regs *regs, int code, > @@ -326,7 +334,8 @@ void _exception_pkey(int signr, struct pt_regs > *regs, int code, > return; > } > > - show_signal_msg(signr, regs, code, addr); > + if (show_unhandled_signals_ratelimited()) > + show_signal_msg(signr, regs, code, addr); > > if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) > local_irq_enable(); > -- > 2.17.1