Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1840040lqe; Tue, 9 Apr 2024 01:43:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUiWptk8zLPULwzrGIa7s+37MiGMsM9OOMTw2k4aXOsjFImif4FL3TlR9VywE+xgcvQtRtIgPjOmH18QCZcb1cdwL9dd8PAjLJLSAS3MQ== X-Google-Smtp-Source: AGHT+IH09CGwBCekWhW29kOuf09P3kUYHhDV/+HnyjijDF/Lenas7t/tG7BK+A6lUwSx5oKhL31c X-Received: by 2002:a50:cd13:0:b0:56e:edc:9837 with SMTP id z19-20020a50cd13000000b0056e0edc9837mr9181579edi.35.1712652211959; Tue, 09 Apr 2024 01:43:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712652211; cv=pass; d=google.com; s=arc-20160816; b=x4U8n/zZLKpcKzn3fLQBlCR9tE66BrLIcYUDcpWH9m0P4UJ/MS7iTYe3Z//ONgVUs8 5Zi3VkqsBpqgfiRHnt0LXtsk2i+0IBE9FStwUUEj/IVObOtnzroSKHpMqLn5QkQX3+A+ mC9xD1+bnjcN5POKs1/58TtjwpELOLQkgU6yHu8rF5eR+QYqaimxT8JbuJHJ0lWFx0Zq ORN6Pw0VNQhXsc5OQSQNG2zWAPINTqs0m/bgF6LXsvRCiBMiLOUQj9nkPfN+LdYAtWEZ l77mkD+FVH/NDmtGo6iBkR6EqdWS/FqxNJ0EqA5O+5Z0BkvJQ6eby8KBHRu8x6Qj4loN 1EUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6cdc1oYa3YB7noLaZJ1CfdlJE9xHs/tjhgyECiyQBrQ=; fh=u32UP1MPeHIdzMZEfnvaj1+CYDhERVe0XVaIG96kKWg=; b=bwoant57vpaNpaWrDKLtu0ywKU4mZwsFo76zsOogHPIS+MltpfnuTBkTzDCDPiJS9a fKiYOhihMNIP9HIacZ9dCYXPgkkFAkMMm9Ay/VaKF4kaUo4iN50iYXGVIrpIWNy+yAN3 N29LBpzf/MdD6PPsMSQD/+RrJEpqJ8AR4hmF+CEnYSLzYqQjOXFQbdqDczq6KtcFyt6C eg96lC3rYwVKRm2jEklFpytjxoNWdaLtJAvaDbUH6hHCF+XhN0KD4Q2FmSmnDK18T+42 n6lpSdITtJ7L8wC1savSJStB38gVqxWIIMI6jn8q41s7x6lEuyn8TjtL8mVzuwscbwD9 Yzrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cFSU5Z2q; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-136478-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r30-20020a50c01e000000b0056e2a6603fdsi4494531edb.403.2024.04.09.01.43.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 01:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136478-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cFSU5Z2q; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-136478-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E5F101F275C2 for ; Tue, 9 Apr 2024 08:35:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10B347FBC8; Tue, 9 Apr 2024 08:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cFSU5Z2q" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 090D07EEF0; Tue, 9 Apr 2024 08:28:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712651287; cv=none; b=bnDRijvZbzsxLS2t9wjHSYlk2lRd24FadDdatAnOYwdyBn80z4yErdDAAoVhfZgwIRtahCc0SiC0yKXDPa/lLLKqFc6YB8BJ4Ie5jikjZOVScx2M4YLuWKSPEIFHPG3BerrHWKK0Lwkh17c/h0XaGcqjHR5JXf5FdagusA4OtLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712651287; c=relaxed/simple; bh=vXLhv3zRRAGARN7FCvEx72w/juFJMhiiJABz8Y2uhpo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HATGumx1f/4lsPe/mBhWD/cCwpFUgaLfyZBkOTsO38vLc4/BwE2AA50jzzvZoTvQwTGBcKxEK04LsShxwvzQDV03I+sq86y5bX0QzfVclNfQflyhqE6tHcdDG0fR5kavZLgi/GLvjh+X1m18XeWsZ8KlKJxManLCK5l2o+tlaDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cFSU5Z2q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 122C0C433C7; Tue, 9 Apr 2024 08:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712651286; bh=vXLhv3zRRAGARN7FCvEx72w/juFJMhiiJABz8Y2uhpo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cFSU5Z2qfdVdK0o/GuxUXrBP2h/PUY8ju+Skd8KKXKk/0KrzHj3fVi3su+QG2p9xx aznJ/3k9pcJsMJe6HfAePAFoc9RNRMLLMcm2hgp4wJUHRMvWajD9yvztKTRpDHiV8W ne9M/bKIWuVmvm1hUCJg3x2/Hmq3WvbASQdCwzns= Date: Mon, 8 Apr 2024 16:51:57 +0200 From: Greg Kroah-Hartman To: Guenter Roeck Cc: Dmitry Baryshkov , Pavan Holla , Heikki Krogerus , Benson Leung , Tzung-Bi Shih , Guenter Roeck , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Abhishek Pandit-Subedi , chrome-platform@lists.linux.dev Subject: Re: [PATCH v3 2/2] usb: typec: ucsi: Implement ChromeOS UCSI driver Message-ID: <2024040837-negligee-expert-bc37@gregkh> References: <20240403-public-ucsi-h-v3-0-f848e18c8ed2@chromium.org> <20240403-public-ucsi-h-v3-2-f848e18c8ed2@chromium.org> <3ezjocthsigo3t746slmgzffnmpxw7wwf3s535basiaf2qy6io@7ocxva6ndsbt> <2024040449-average-foyer-defa@gregkh> <2024040422-ripcord-bladder-bdda@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Apr 08, 2024 at 06:04:22AM -0700, Guenter Roeck wrote: > On Thu, Apr 4, 2024 at 6:30 AM Greg Kroah-Hartman > wrote: > [ ... ] > > > > > > if (WARN_ON_ONCE(val_len > MAX_EC_DATA_SIZE)) > > > > > return -EINVAL; > > > > > > > > So if you trigger this, you just rebooted all boxes that have > > > > panic-on-warn enabled (hint, the HUGE majority in quantity of Linux > > > > systems out there.) > > > > > > > > So don't do that, just handle it like this. > > > > > > Does that mean that we should not use WARN at all? What is the best > > > current practice for WARN usage? > > > > To never use it. Handle the issue and recover properly. > > > > > I'm asking because for me this looks like a perfect usecase. If I were > > > at the positiion of the driver developer, I'd like to know the whole > > > path leading to the bad call, not just the fact that the function was > > > called with the buffer being too big. > > > > Then use ftrace if you are a driver developer, don't crash users boxes > > please. > > > > If you REALLY need a traceback, then provide that, but do NOT use WARN() > > for just normal debugging calls that you want to leave around in the > > system for users to trip over. > > > > That is not common practice. > > $ git grep WARN_ON drivers/gpu | wc > 3004 11999 246545 > $ git grep WARN_ON drivers/net/ | wc > 3679 14564 308230 > $ git grep WARN_ON drivers/net/wireless | wc > 1985 8112 166081 > > We get hundreds of thousands of reports with warning backtraces from > Chromebooks in the field _every single day_. Most of those are from > drm and wireless subsystems. We even had to scale back the percentage > of reported warning backtraces because the large volume overwhelmed > the reporting system. When approached about it, developers usually > respond with "this backtrace is absolutely necessary", but nothing > ever happens to fix the reported problems. In practice, they are just > ignored. Then push back on the developers please, this isn't ok. WARN_ON triggers so many automated systems it's not funny. And if a trace back is really needed, there is a function for that, but really, just fix the issue and handle it properly. > This means that any system using drm or wireless interfaces just can > not really enable panic-on-warn because that would crash the system > all the time. I guess Android doesn't use wireless or drm :) Again, billions of systems in the world has this enabled, let's learn to live with it and fix up our coding practices to not be lazy. thanks, greg k-h