Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp516378rwr; Thu, 20 Apr 2023 02:39:47 -0700 (PDT) X-Google-Smtp-Source: AKy350aQAxsJYsUD7ntAUqmF5iUjh69d29kl6m8ci+3PszJBE3lS4lraJKL1Wytf1y4tKuWoqT7q X-Received: by 2002:a17:903:1212:b0:1a6:5118:cb95 with SMTP id l18-20020a170903121200b001a65118cb95mr1152716plh.23.1681983587498; Thu, 20 Apr 2023 02:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681983587; cv=none; d=google.com; s=arc-20160816; b=gSq2nTYtGiV4dXGk3kzfg6NBO98nv637whaDg/HBo1pQZC3nhpoTkZCM/6r5bIeiao uNxRh3NvtiyHNEMHR318yBTy5pzkaKG+3DrWo3Q18DKyt5jOLWA67RbfEPmxBXCEcmU2 p/MsetsooY5b8oUwxkeRzEQmbXAozdt2NTjIIFQmyFt8nNxHLSvjuWbInisxB78UdAro DyZMrlauIcKURueohjjsUcCKCrHmvvMrLSfVnIV0CqnssO2MlB78j2Zq9zgekDYJ8Df0 lP5ay6L5D9DPHgAFtuYTnMauWaAJP+9J7dC3N10Xw0TDw6q/zzlc9H8LxQFRsz3GaPNV yd1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :dkim-signature; bh=NA/k4um9rHRfY4bXrpGgru77EhrVPivd3J33GG3aYO8=; b=F8clvb0FjjQXjczfq3MVYH7TDf30b5hxvxtp1GUz4nHUotZVXGy+QBj64Hlp7gxVPA DDIzX2loVFkPuzrLk3+5uAodqro92skQHhEOqauNsp2JXMfsldydlwIIje4ioHY875iQ Y2UnY+hzHAeBnE6EgqjGtwFKm8qjoeFhQsxPb0xWyw6SrBH9PrQbZU8cHzROsCeKkPoS DhJee9xsNYHjf3LVrsR7FvdsIAsE+7AAT8wW8BLJZTYArd8a5djeW8ULEPs+5pHbm9MK +AnzFUq9Jbw5wpT8yJvZ++Mm7Y+pdU8yDQLU1pb4VpbgGulg6KU57iEamKox7SveMHOU ToaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (no key) header.i=@uni-rostock.de header.b=dfQWKSyL; dkim=pass header.i=@uni-rostock.de header.s=itmz header.b=eTzbK3XI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uni-rostock.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a63e54f000000b0051b718151a4si1248620pgj.201.2023.04.20.02.39.35; Thu, 20 Apr 2023 02:39:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=neutral (no key) header.i=@uni-rostock.de header.b=dfQWKSyL; dkim=pass header.i=@uni-rostock.de header.s=itmz header.b=eTzbK3XI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=uni-rostock.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234439AbjDTJhw (ORCPT + 63 others); Thu, 20 Apr 2023 05:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234487AbjDTJg5 (ORCPT ); Thu, 20 Apr 2023 05:36:57 -0400 X-Greylist: delayed 360 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 20 Apr 2023 02:36:43 PDT Received: from mx1.uni-rostock.de (mx1.uni-rostock.de [139.30.22.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 473DE359A for ; Thu, 20 Apr 2023 02:36:43 -0700 (PDT) DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmze; t=1681983040; bh=NA/k4um9rHRfY4bXrpGgru77EhrVPivd3J33GG3aYO8=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=ed25519-sha256; b= dfQWKSyLbiFxFFfiyCSOTc+96FhB867UzFmywXVCGYQAvVF5Wy3jsswdm1/pT+CrquqvHOjj/oW5ILFEatXcAg== DKIM-Signature: v=1; c=relaxed/relaxed; d=uni-rostock.de; s=itmz; t=1681983040; bh=NA/k4um9rHRfY4bXrpGgru77EhrVPivd3J33GG3aYO8=; h= Subject:Subject:From:From:Date:Date:ReplyTo:ReplyTo:Cc:Cc:Message-Id:Message-Id; a=rsa-sha256; b= eTzbK3XI2yNAXpPtpV92UuACqXjdd0YO9AXVkQvQoeQ2gNTNcBdRdD2JWmLg/VlLn+HTpp4ODRgf/rHoLrir8fbuM7mLKXsnoBjd1ToipSxQRKmssKJFdcZbUZSONnnz4CgeCuRJfh2aLrsv51qOkynPaAoPv2ZD7GyrepP1Dz8= Received: from 139.30.22.84 by mx1.uni-rostock.de (Tls12, Aes256, Sha384, DiffieHellmanEllipticKey384); Thu, 20 Apr 2023 09:30:40 GMT Received: from [139.30.201.34] (139.30.201.34) by mail1.uni-rostock.de (139.30.22.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 20 Apr 2023 11:30:39 +0200 Message-ID: <50a76761-5be3-8ea7-c2f3-a14c158aa039@uni-rostock.de> Date: Thu, 20 Apr 2023 11:30:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v1] wifi: mac80211: Initialize EWMA fail avg to 1 Content-Language: de-DE To: Johannes Berg , Karthik M CC: , Tamizh Chelvam Raja References: <20230417100258.22965-1-quic_karm@quicinc.com> From: Benjamin Beichler X-Enigmail-Draft-Status: N02210 Organization: =?UTF-8?Q?Universit=c3=a4t_Rostock?= In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [139.30.201.34] X-ClientProxiedBy: EMAIL2.uni-rostock.de (139.30.22.82) To mail1.uni-rostock.de (139.30.22.84) X-TM-SNTS-SMTP: E863240B04B14804C3219B25F24F284C1B09F1985DBA2AEEE7B5932F10C236F32000:8 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-wireless@vger.kernel.org Hi, > > This still seems really non-intuitive to me. > > It seems to me this is down to the special "0 means init" behaviour, > that you don't want, because your values actually fluctate between 0 and > 100, and you can actually legitimately reach 0 with a lot of successes. > > But to me it's really non-intuitive, if not counter-intuitive, to say > "oh yeah my values are 0 to 100 inclusive, but I can't ever deal with > reaching 0 because then I jump to 100 immediately". That doesn't make > much sense to me? > > I mean, I guess I can see where this patch makes some sense like from a > code point of view, this is sort of the minimal code change you could > make to make the existing code work, but ... I'd argue you're optimising > to the wrong metric here, "minimal code changes to fix the bug" should > normally not be your metric, it should be "code changes that make this > clearer and avoid the problem", or something like that? > > Anyway I guess that's all a long-winded way of saying that I don't > really agree with this change. > > To me, basically, I see two ways to solve this: > > 1) we have DECLARE_EWMA_ZERO_VALID() or something like that which > *doesn't* treat 0 as an uninitialized value, and either has a > separate "not initialized yet" bit (but that's iffy storage wise), > or simply has another argument to _init() for the initial value or > so. > > 2) you don't just don't use 0 and 100 but say 1 and 100, that results in > basically the same behaviour, but avoids the special 0. > > johannes I also ran into that problem in the past, and reviewing it again with a college, I think, this is a real bug in the EWMA implementation. I try to provide a proper patch in the next days, but actually the EWMA handles the internal value zero, always like in the initialization, which is wrong, e.g., for positive/negative averaged values. A quick research shows, this bug is since the first implementation of the ewma in the code ... kind regards Benjamin