Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32879rwd; Wed, 17 May 2023 14:11:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5doZczAkJ7ECP1a69WCYIuqKn0BYgd3pr7m2XxHZ8t799GWQZnxWlrFyvZilb+byng4mwN X-Received: by 2002:a05:6a20:918a:b0:104:edde:67be with SMTP id v10-20020a056a20918a00b00104edde67bemr20642201pzd.17.1684357882844; Wed, 17 May 2023 14:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684357882; cv=none; d=google.com; s=arc-20160816; b=YblvwYlkcCn5KeFZnIPhcgr5QeVZtZTQ0UZMA/7iyrPCGh2Th/lQvQm4+6/XhsD96N +Bn/dEbcyu9FS3EcyoI6TVUHSMgpB9gcNWMTRh46WoAbTyaup5MXg7X3xuGtzbjv+WOo NBC4Se2m9KMjISoRuokpkkmEi15WKt4rOBFcYZSaVvLf35pmbXgfLOsOGTuypCRkfKVF B4rW1YO61EqsLvFzmNUGbcvykoOUnuBluxP0whaMSGUPCsvZu7qqSmg0ZzzX3b+HIz9Q tBfD7RZf9ZutxFzwCnJqcrLunuGdXG7bxMO5iFx4X9YxhuFmM996has1QFHmT/9DLVy6 XPPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=EcYeLGK9CKTywc7ALkojexG3Ujj8hio2Irffds26ng8=; b=h8XTFIuF678JafCc7NpLflB0Ap5asoNzDeZT/8G+XaBRg+mhy6yGowXMcFxttUss42 bYUU2b0JfRcC6xNmdZu9z094BDLl45A+wWryck8LFr60BetxFFv0ZSaSKgmCHbKZqVDt MLwTqRr8LISUjy0Yw47sTRHFaWgLFSmquaIbcaLuz+A28ilcucSapiAfN2EVnssaJYZ+ 4QREgQvaFKDM0h3RlIB3WDXXeTdTvGAbQQsUIWp7GrlJIwiKZRfozufOzwx2DpVF8lyt I+77bFyaovcJMBIrC4TLd70YP+kk6U12f7vW3nd/vCX2qGdeVW3XXdktiJyRCoqiG645 TQUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=l0Vn+PJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o10-20020a637e4a000000b00524b3efc310si21353280pgn.83.2023.05.17.14.11.08; Wed, 17 May 2023 14:11:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=l0Vn+PJf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229475AbjEQVC6 (ORCPT + 99 others); Wed, 17 May 2023 17:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbjEQVC6 (ORCPT ); Wed, 17 May 2023 17:02:58 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA48340EB for ; Wed, 17 May 2023 14:02:56 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-33164ec77ccso49245ab.0 for ; Wed, 17 May 2023 14:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684357376; x=1686949376; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=EcYeLGK9CKTywc7ALkojexG3Ujj8hio2Irffds26ng8=; b=l0Vn+PJfSyVTO2gHeH3x4fH2JjOQEcj0rIJbOythNeDP8VOHqOEMK1yeOgpSD/YgQa 24ZpUrWjEzUM4pXro/9E4sUOxgdYWLDCMJNlprEjlntbOk8dUDiqJAImOM/WP7fr+J7h ygKzUkbYhDr2QsQzMuthz/735hJm9iFqHkQm8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684357376; x=1686949376; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EcYeLGK9CKTywc7ALkojexG3Ujj8hio2Irffds26ng8=; b=BClytjRho//q4EgbCDPbmM6tbaictYKAdcSRRm7cG861DawZ8vBIKStiT7h7jfjFhM ZFH83NWvRssb5ihgV2sHzVe8AlEmI7T1RuJDKVaqq3kLxVTJculYEx2wgk+kdxnAffjG qWhtdTnlEcZ5xrzrccXwkhPLy6F64gnrN8QNmtd/+835O3TWfTNHIhkVnaRanvXfxQGU QCAOMRN5yjtFpzmuHXk5AGegEtFJ1ytOSGFXa4tL0U8u/BPtzGv0B62KXEa7hnWZGdX1 l1Fp2BCpeAqUOoLdwyZXHM+ZCeVM+kdr+JZZ/UzQQUJpa4ZyVGhoaPmYN1trZT+G6IRP EKPQ== X-Gm-Message-State: AC+VfDxYQlVCqA42MKcNDvzvc2b2PX3SXBY/dQqQzmbiFEfjd96X82TI BUKOwgnMSH8zVhFDrDTMA+f2E6Jx92o0ksPGYpUmpw== X-Received: by 2002:a92:c24e:0:b0:331:948c:86f3 with SMTP id k14-20020a92c24e000000b00331948c86f3mr19472ilo.19.1684357375830; Wed, 17 May 2023 14:02:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Grant Grundler Date: Wed, 17 May 2023 14:02:43 -0700 Message-ID: Subject: Re: [PATCHv2 pci-next 2/2] PCI/AER: Rate limit the reporting of the correctable errors To: Bjorn Helgaas Cc: Grant Grundler , Rajat Jain , Rajat Khandelwal , linux-pci@vger.kernel.org, Mahesh J Salgaonkar , linux-kernel@vger.kernel.org, "Oliver O 'Halloran" , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 17, 2023 at 9:03=E2=80=AFAM Bjorn Helgaas = wrote: > > On Fri, Apr 07, 2023 at 04:46:03PM -0700, Grant Grundler wrote: > > On Fri, Apr 7, 2023 at 12:46=E2=80=AFPM Bjorn Helgaas wrote: > > > On Fri, Apr 07, 2023 at 11:53:27AM -0700, Grant Grundler wrote: > > > > On Thu, Apr 6, 2023 at 12:50=E2=80=AFPM Bjorn Helgaas > > > wrote: > > > > > On Fri, Mar 17, 2023 at 10:51:09AM -0700, Grant Grundler wrote: > > > > > > From: Rajat Khandelwal > > > > > > > > > > > > There are many instances where correctable errors tend to inund= ate > > > > > > the message buffer. We observe such instances during thunderbol= t PCIe > > > > > > tunneling. > > > > ... > > > > > > > > > if (info->severity =3D=3D AER_CORRECTABLE) > > > > > > - pci_info(dev, " [%2d] %-22s%s\n", i, er= rmsg, > > > > > > - info->first_error =3D=3D i ? " (F= irst)" : > > > ""); > > > > > > + pci_info_ratelimited(dev, " [%2d] > > > %-22s%s\n", i, errmsg, > > > > > > + info->first_error = =3D=3D i ? > > > " (First)" : ""); > > > > > > > > > > I don't think this is going to reliably work the way we want. We= have > > > > > a bunch of pci_info_ratelimited() calls, and each caller has its = own > > > > > ratelimit_state data. Unless we call pci_info_ratelimited() exac= tly > > > > > the same number of times for each error, the ratelimit counters w= ill > > > > > get out of sync and we'll end up printing fragments from error A = mixed > > > > > with fragments from error B. > > > > > > > > Ok - what I'm reading between the lines here is the output should b= e > > > > emitted in one step, not multiple pci_info_ratelimited() calls. if = the > > > > code built an output string (using sprintnf()), and then called > > > > pci_info_ratelimited() exactly once at the bottom, would that be > > > > sufficient? > > > > > > > > > I think we need to explicitly manage the ratelimiting ourselves, > > > > > similar to print_hmi_event_info() or print_extlog_rcd(). Then we= can > > > > > have a *single* ratelimit_state, and we can check it once to dete= rmine > > > > > whether to log this correctable error. > > > > > > > > Is the rate limiting per call location or per device? From above, I > > > > understood rate limiting is "per call location". If the code only > > > > has one call location, it should achieve the same goal, right? > > > > > > Rate-limiting is per call location, so yes, if we only have one call > > > location, that would solve it. It would also have the nice property > > > that all the output would be atomic so it wouldn't get mixed with > > > other stuff, and it might encourage us to be a little less wordy in > > > the output. > > > > > > > +1 to all of those reasons. Especially reducing the number of lines out= put. > > > > I'm going to be out for the next week. If someone else (Rajat Kendalwal > > maybe?) wants to rework this to use one call location it should be fair= ly > > straight forward. If not, I'll tackle this when I'm back (in 2 weeks > > essentially). > > Ping? Really hoping to merge this for v6.5. Sorry - I forgot about this... I'll take a shot at it. Should have something by this evening. cheers, grant > > Bjorn