Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp16816iog; Thu, 16 Jun 2022 20:19:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tLiay5dkQrxag0hbU6V8KPA3bahBtFDc7NSa7LCum/LIjzg0nYtHbeFonZc/R/ePwdf0Nf X-Received: by 2002:a17:902:ceca:b0:166:3418:5267 with SMTP id d10-20020a170902ceca00b0016634185267mr7536654plg.136.1655435954904; Thu, 16 Jun 2022 20:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655435954; cv=none; d=google.com; s=arc-20160816; b=AGvHWO9aWbQWVf/Jxdu98J02TOZWhMl0FbKznGBzOlvuakFfHOHqBktNF09e0FNP2v Axe+zp9AcSUDlZGgS3EbzZxgeLVfCw4DiCYHB12ihFBRKbE21zn6AA1rAYh6gVt0YOP1 wYG3zTsT/CJ9Em9LO/z2cLTnUpZYkquiD1ANcBcV9ZmHOJKSyVhnStbEyD5Vg8hsQfa0 b48PwNx+O0VMfvmR371bGfvd6f9z6H2bSUHqR86swCtVtd8N+cf+2FwzCv2dLOwS2QBk QNYGh+2Tz/F4TRXd6MR1yfALYM2xLqu0aM3/44j/TW9I9akMzQz8TfQH8YWCGDqOd/P/ oyRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=05w5k2H6iAH0ZgNLPs0+l2PLAxsLXlw8R/ymoZjeiWA=; b=vHDJ4WpE7vbK9daN2MANT50AGwMbc/CFrKSdJIfxNnSM0wexjtsnWBtKtGkbe/U7kL P3HmTiiVcJjyOlwdzq0uIqrV00OHqeGTYt6vnmOl284LwZJdlVOHVI2gtfRaHIZ0gmDk r7e7G6gspPtQSL/bqvT39keVqQKyRaONDcJR+tht/zxKetDcGud4wpWtditbKbftg8oV no1zHxs7/ZBXHUO7UKxByZQ7+soiZG9yNr0A23kmr7kpqdO+ej6Mk8ggmGfTRHttkDVw hlcWqLBXXQcJN2yBPL4QibpZUrFhrPKzTx02TBVmrR/ftNbPUhfX7XyI49nURa0zjnBJ dcrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=L1ijCKGk; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a170902ce8700b001675d8490e4si4826153plg.563.2022.06.16.20.19.00; Thu, 16 Jun 2022 20:19:14 -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=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=L1ijCKGk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380000AbiFQDIh (ORCPT + 99 others); Thu, 16 Jun 2022 23:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379971AbiFQDIS (ORCPT ); Thu, 16 Jun 2022 23:08:18 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69BD5F8E5 for ; Thu, 16 Jun 2022 20:08:17 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id f8so2788521plo.9 for ; Thu, 16 Jun 2022 20:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=05w5k2H6iAH0ZgNLPs0+l2PLAxsLXlw8R/ymoZjeiWA=; b=L1ijCKGk+5t0GFYr6QoXTOuTW2lQ5YXPwcnoiMY7ETJ5r4InHxmUSox96iNVWIPCw7 geORc75Yp0A2REzbnK7CIdy4w5GE43FtCMMn1KwfKHunoyksryjt4mWmipSGDdYq0/n9 lIjFSVM6xulhkuDMwgJZR2poUmQXSO0NCrT6BipgsBFZI8EbiGVxoW5IvB41/vO8bGRw 1I+pOnNq0JSBJJuz0wWkvhx0xh9qMLS5zzji571ujkr6aO79+/rEATfwIp4eQf/8qK9p YcV53uvub22JVngjEt0OaMC306j0pcf9eYPTI5R+PbBbCPBuIIzX3yFQy2g3Z8+gXsID ngaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=05w5k2H6iAH0ZgNLPs0+l2PLAxsLXlw8R/ymoZjeiWA=; b=kZd8L0Wjtign6b1abfTBa8OGlOZQjM7otIFjeDB86tICiiLm9Hbtu+hyOZ3olC8El+ KdRZYlO0zbW2neQl2dhTQ9oJ9Pplx2h2winXIhd4MjZ2yGeLjhLLZsjmR7ot6df2IkIe nWQ2hKtpq5dNFY+kv1sJCDBFjlqHKWedygYNCmv1/Ws/3KNPAvrUnXj+yRmdU5boceBi C69VyaBjZAvUiV5391QhtjWg0u0d+ONIFtLJmQv3Xw+liNg0hy5C9AlPToLe/Rvbtqpz WeS4ybEf5fNDSgbH/YvJG8HCRqPVJ+h+Aj++pWrXdlD4U1gv9NABlmSkOsYD53mtcfNX U4Pw== X-Gm-Message-State: AJIora9r7tcHQdovlVob/XkPo9AdEH8/cNHhn5n/orGI65W59A0GtGRC 0Lly9dmbRQnYClsXi2HK+gquPQ== X-Received: by 2002:a17:90b:4b47:b0:1e8:9529:27c6 with SMTP id mi7-20020a17090b4b4700b001e8952927c6mr18956391pjb.178.1655435297320; Thu, 16 Jun 2022 20:08:17 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u15-20020a170902714f00b00168c1668a49sm2334325plm.85.2022.06.16.20.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 20:08:16 -0700 (PDT) Date: Thu, 16 Jun 2022 20:08:14 -0700 From: Stephen Hemminger To: Peilin Ye Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , Peilin Ye , Yuming Chen , Ted Lin , Dave Taht , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang Subject: Re: [PATCH net] net/sched: sch_netem: Fix arithmetic in netem_dump() for 32-bit platforms Message-ID: <20220616200814.15fff125@hermes.local> In-Reply-To: <20220616234336.2443-1-yepeilin.cs@gmail.com> References: <20220616234336.2443-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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-kernel@vger.kernel.org On Thu, 16 Jun 2022 16:43:36 -0700 Peilin Ye wrote: > From: Peilin Ye > > As reported by Yuming, currently tc always show a latency of UINT_MAX > for netem Qdisc's on 32-bit platforms: > > $ tc qdisc add dev dummy0 root netem latency 100ms > $ tc qdisc show dev dummy0 > qdisc netem 8001: root refcnt 2 limit 1000 delay 275s 275s > ^^^^^^^^^^^^^^^^ > > Let us take a closer look at netem_dump(): > > qopt.latency = min_t(psched_tdiff_t, PSCHED_NS2TICKS(q->latency, > UINT_MAX); > > qopt.latency is __u32, psched_tdiff_t is signed long, > (psched_tdiff_t)(UINT_MAX) is negative for 32-bit platforms, so > qopt.latency is always UINT_MAX. > > Fix it by using psched_time_t (u64) instead. > > Note: confusingly, users have two ways to specify 'latency': > > 1. normally, via '__u32 latency' in struct tc_netem_qopt; > 2. via the TCA_NETEM_LATENCY64 attribute, which is s64. > > For the second case, theoretically 'latency' could be negative. This > patch ignores that corner case, since it is broken (i.e. assigning a > negative s64 to __u32) anyways, and should be handled separately. > > Thanks Ted Lin for the analysis [1] . > > [1] https://github.com/raspberrypi/linux/issues/3512 > > Reported-by: Yuming Chen > Fixes: 112f9cb65643 ("netem: convert to qdisc_watchdog_schedule_ns") > Reviewed-by: Cong Wang > Signed-off-by: Peilin Ye > --- > net/sched/sch_netem.c | 4 ++-- Thanks for fixing. Guess it is time to run netem on one of the Pi's. Acked-by: Stephen Hemminger