From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755081AbcGEUyH (ORCPT ); Tue, 5 Jul 2016 16:54:07 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48039 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbcGEUyE (ORCPT ); Tue, 5 Jul 2016 16:54:04 -0400 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: borntraeger@de.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Subject: Re: [PATCH -v3 1/2] ratelimit: Extend to print suppressed messages on release To: Joe Perches , Steven Rostedt , Borislav Petkov , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Cornelia Huck References: <1467642292-15671-1-git-send-email-bp@alien8.de> <1467642292-15671-2-git-send-email-bp@alien8.de> <20160705142648.57456ef8@gandalf.local.home> <20160705184517.GF12027@pd.tnic> <20160705145732.4b6dbd55@gandalf.local.home> <20160705194244.GG12027@pd.tnic> <20160705154959.2705b658@gandalf.local.home> <1467749333.16342.5.camel@perches.com> Cc: LKML , Andrew Morton , Franck Bui , Greg Kroah-Hartman , Ingo Molnar , Linus Torvalds , Peter Zijlstra , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Janosch Frank From: Christian Borntraeger Date: Tue, 5 Jul 2016 22:53:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1467749333.16342.5.camel@perches.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070520-0008-0000-0000-000002982DF9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070520-0009-0000-0000-000018FC2648 Message-Id: <577C1E63.8060608@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-05_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050185 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/05/2016 10:08 PM, Joe Perches wrote: > On Tue, 2016-07-05 at 15:49 -0400, Steven Rostedt wrote: >> On Tue, 5 Jul 2016 21:42:45 +0200 Borislav Petkov wrote: >>> On Tue, Jul 05, 2016 at 02:57:32PM -0400, Steven Rostedt wrote: >>>> Perhaps we should show both, unless you don't think this will ever be >>>> used by anything other than devkmsg? >>> I'd say let's do it only when we go down that road and start using it >>> for something else. >>> >>> Because, for example, the ratelimiting thing is, in fact, generic but it >>> is used primarily to ratelimit printks. Even though it could be used for >>> something else, theoretically... >>> >> But you know... Build it and they will come. > > arch/s390/kvm/kvm-s390.c: ratelimit_state_init(&kvm->arch.sthyi_limit, 5 * HZ, 500); > > As far as I know, _ratelimit is used for non-printk purposes in > arch/s390/kvm/sthyi.c > > int handle_sthyi(struct kvm_vcpu *vcpu) > { > int reg1, reg2, r = 0; > u64 code, addr, cc = 0; > struct sthyi_sctns *sctns = NULL; > > /* > * STHYI requires extensive locking in the higher hypervisors > * and is very computational/memory expensive. Therefore we > * ratelimit the executions per VM. > */ > if (!__ratelimit(&vcpu->kvm->arch.sthyi_limit)) { > kvm_s390_retry_instr(vcpu); > return 0; > } Yes, this is new in next. As far as I can see, the new message would only appear if we would call ratelimit_state_exit. Correct? We do not call this - I assume this is ok? We really only want to reuse the rate limit base code (to avoid writing the same code twice) and being in lib indicated that this can indeed be used outside printk. Now: your patch 1 would allow me to get rid of the messages completely by setting the flag and by not calling ratelimit_state_exit. Which is probably what we should do in our code. Christian