From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59744C433B4 for ; Wed, 14 Apr 2021 09:41:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37CCD60FF0 for ; Wed, 14 Apr 2021 09:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232832AbhDNJmB (ORCPT ); Wed, 14 Apr 2021 05:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbhDNJlx (ORCPT ); Wed, 14 Apr 2021 05:41:53 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC7EC061574 for ; Wed, 14 Apr 2021 02:41:31 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618393289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/4/RHxsfohskTtOw0aS3OJVyodBBIJyJEVripy2Vc2k=; b=Xi/8vu3k7TfI91QEGRmY+fGcKdPHvqUVfgBi8X4PQLU+RmqA96BKAN8zED/usdls8Mhyop SeieeMWhRV4igMWpz2arMUBK5ms9SLPxS8PFhs16ZSca5ea1uDU1zLXWHa9EAoE9KrI+mi e/UGwI9UOMtUpYl7isMGvSidBcc5yt54K9BZHjgAC8oUaW/dbCRAIGOxDT9vKr+H2r1B1P kMQcUrX059XAhyJN5zbN2LtLMCkpUeL6g5JhS5slms14uVmdvLXwGKjpSLmCm8ZQlzxS13 ScM+oRk6bzdOIk+moht4TnvRNCK8cNCvvDDBw7K4GTy062PwR1bYEyj9TMNV4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618393289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/4/RHxsfohskTtOw0aS3OJVyodBBIJyJEVripy2Vc2k=; b=R8EienE+8n7C5nXqMeTQ2Mlh0sWjF9TDZZ7uVMilOuVYu6i33kOPD7unTcVWQlQqGpoeIy eFxuijItjo9zJbBQ== To: Fenghua Yu Cc: Ingo Molnar , Borislav Petkov , Peter Zijlstra , Tony Luck , Randy Dunlap , Xiaoyao Li , Ravi V Shankar , linux-kernel , x86 Subject: Re: [PATCH v5 2/3] x86/bus_lock: Handle #DB for bus lock In-Reply-To: References: <20210313054910.2503968-1-fenghua.yu@intel.com> <20210313054910.2503968-3-fenghua.yu@intel.com> <871rca6dbp.fsf@nanos.tec.linutronix.de> <878s6iatdf.fsf@nanos.tec.linutronix.de> <8735vw2cub.ffs@nanos.tec.linutronix.de> Date: Wed, 14 Apr 2021 11:41:28 +0200 Message-ID: <875z0pxkxj.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fenghua, On Tue, Apr 13 2021 at 23:40, Fenghua Yu wrote: > On Mon, Apr 12, 2021 at 09:15:08AM +0200, Thomas Gleixner wrote: >> Aside of that why are you trying to make this throttling in any way >> accurate? It does not matter at all, really. Limit reached, put it to >> sleep for some time and be done with it. No point in trying to be clever >> for no value. > > Is it OK to set bld_ratelimit between 1 and 1,000 bus locks/sec for > bld_ratelimit? > > Can I do the throttling like this? > > /* Enforce no more than bld_ratelimit bus locks/sec. */ > while (!__ratelimit(&global_bld_ratelimit)) > msleep(10); > > On one machine, if bld_ratelimit=1,000, that's about 5msec for a busy > bus lock loop, i.e. bus is locked for about 5msec and then the process > sleeps for 10msec and thus won't generate any bus lock. > "dd" command running on other cores doesn't have noticeable degradation > with bld_ratelimit=1,000. Something like this makes sense. Add some rationale for the upper limit you finally end up with so sysadmins can make informed decisions. Thanks, tglx