Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1490204lqe; Mon, 8 Apr 2024 10:14:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWfU1fdim7DIqKbxuc3d10DVEZkL3btJaBBVqfReBEFj8RPgG39TWcmebhqcjWNpEfAplCisDgIH2dA8UY+sY2yecf6Ko7VHGnQlOzuw== X-Google-Smtp-Source: AGHT+IG5TGTKxDAywFPdzXfho2Phj62HHPYonvwxSqqvruXzdHJkhBJTfzo0/nnzBp+GQP+QpwRy X-Received: by 2002:a05:6214:5854:b0:699:42c0:3c6e with SMTP id ml20-20020a056214585400b0069942c03c6emr539104qvb.3.1712596442699; Mon, 08 Apr 2024 10:14:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712596442; cv=pass; d=google.com; s=arc-20160816; b=EivWB8PWP52BP52D9SQ2UIyCxg3NhC6pOrCeSunzXmXIY3/6DeSVhI6zMKG6KfmK3T diPFcILUyjchNrbot4aSkSh3pJGtqPepAXuXfy7CTFNo2zklwmsnAw4auwWZAsAnKbQC 8PdWd8UTNYTh93PN4XvAdu10mqCEzIGNvp1QwnCJim65OD5q4jl085zsztA1pBjY8zJn TE+mWQCPLE/5YBd9U9zlpEW43ZcUcrSWilMQ/YloehGJbL76HSAAp4IW09zBqBvT3SGD 1ngiQw2Yy8qENmIHn5W22biKkTvJCljCFxvfuhIlx3KQd3r41M3SIw2GC5CmeXwPc4od Ef2Q== 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=T8TRMrj5ggtPr7yueS0y7TsmLoLHnTwJgZ1LoVKqCBE=; fh=Ya2Tf0cRMPEHWy+srnlCKYF8mjO8vNOv6yhrsC5tNhI=; b=0IpPtJtAOXEZQQTrTPcadIGWPgLrU26pQeOmplYXMptC/qN4HCoEVetYf8NPyMmA5R IeZJVmKTQQOHNUeW4kgR1lAbB0EczzQ7rFMFgT6zsWryGPTXQvqmWk6S4aAZwn6vfHZy rQrFvwmnc2/bYdLs06qFO9ZThjMw/PRY/r3GYJnrmnlGKdv5VAcMmMHAHPmWoXFH/oWE d3GFMylW9Immk9UM/NuRP0jWHP2OcxWneTEQtjuERznFv/2Vd0FkcGb0WCLkPp+fhx98 BUKBverzQY0uShyuvoEHig4qnLELbuqHdxDJX7n+EuZqa5iKUgBXGmwCZr5wxsMrvj+m ulGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XsgXaK3B; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-135731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y5-20020a056214016500b0069b111747ccsi4513855qvs.456.2024.04.08.10.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XsgXaK3B; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-135731-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E9F941C23F32 for ; Mon, 8 Apr 2024 17:12:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64CC114388F; Mon, 8 Apr 2024 17:12:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XsgXaK3B" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCCCF142906 for ; Mon, 8 Apr 2024 17:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712596341; cv=none; b=BclPxHLf8xGZOFqBncjA/QrNO21a7DxRIfSbiYs+iksjlcAw/Vziv7xudisSFZToCqxSRrnbZy6KqPmFgD11iQSL0ZCvEaJ+41O8NVoqMwSKjoHz88YTH3e2gw8aw7pfYmMDcbdmO0TX0dVZCqSU4FbZ5FoYGgXhNXWqDKYMlx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712596341; c=relaxed/simple; bh=oJ9mT+vwINWrYV759TkgfgMbkpyg67bL62cpIdVNlF8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MOxEZy+ENGvSKL3mFsYfjwSxiv40L02MQw8DQoXWBdPzhUeEtSPpToWpHgNkot2H+JvBkojtxKVr9+PtZ5w39tSwGlF/9yERtnYipNCnfubEIJxEYP2bx24lU0TyWG1E34VFHcv0rOGnTDfrZsET9eqgBA0ZSc+AZ7OLiq8bq2g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XsgXaK3B; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-516d04fc04bso7030040e87.2 for ; Mon, 08 Apr 2024 10:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712596338; x=1713201138; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=T8TRMrj5ggtPr7yueS0y7TsmLoLHnTwJgZ1LoVKqCBE=; b=XsgXaK3BWIHwpxfooljCkxPs3MoOdtZhpSKU6RE6g+jKcBUPHDOetLcAoN43Y+uZCh l9slml0lqf69WkmW1j1BnvaUWsn/mU/4gA/DtZaxrNM75Qfnbrqxwmwy7Zw29jQmU4Dh X4WEA6two1XsP7YTDlj6nmqT40o1dhIMd/1uFkjfp1LG4R3QxIB+VH6poMid2m6I7PqO IpO2ySm0BiRZnlQvvwTw9m2pfP4IslTrRFoWhFCa0qRXAg/99OuYrh5T4vv/8Zj9cPU9 5qYD9GvqYHkTIONS6+pCmHKURt5UwHLoAcPI3sTX94cUucZwAVtLIjO4fttlrAhdxoap xF4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712596338; x=1713201138; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T8TRMrj5ggtPr7yueS0y7TsmLoLHnTwJgZ1LoVKqCBE=; b=fox6RGjEci+r3iwD5XeR0riK4AAfqOHShPqD9Xvraaho3B0j8ztGhTpZbc1eAjmOZ1 lc3ecuKcYuD1MoC/pBf+UtlWJaaMmXBeS7iZ4km8C1e/eA1MeIK+yAqfQbNurnjY8ome SI1hMf7egVMqInut85Rye5zHhfHvn72EDGf6WpP0yodB7dgkwjDtXzWVe+Shd/5YLEJP nufRra2ILqqx31hfn9ya/jchFKvZbsDurKNsEXQUXlIKddxQVkWRQ9WAeUzRvEPjjczU zeSZfYNpnMitcW7XD2Pn+xAxoTKRKn8AA7sLpdrbQ9ocO0kNoTpJpHMjpbg2NbR34+xv ScKQ== X-Forwarded-Encrypted: i=1; AJvYcCUGq+2zDqnvka0I1xvJltWJM0NV0SF6Cr2oCi5/vTuU8FXL0nbUPJT3rmxe5/0FxutIKO6ub7IPnjnGvzsHetd1WHT/yDKUNqeNz/uO X-Gm-Message-State: AOJu0YzMlCcJ3klGFiiyD+cMBZ3nv+cs9oCHwro2xYk9GktePT+Bgqlj Xb2MqJSkBLG5zuRTYHvmn9/nm5e2cRZuz4ZG0esqaaU41iVHUCUELEvnD7VgcEk= X-Received: by 2002:a05:6512:52b:b0:516:c1b9:316b with SMTP id o11-20020a056512052b00b00516c1b9316bmr8096374lfc.15.1712596338037; Mon, 08 Apr 2024 10:12:18 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzyjmhyyyyyyyyyyyykxt-3.rev.dnainternet.fi. [2001:14ba:a00e:a300::227]) by smtp.gmail.com with ESMTPSA id k6-20020ac257c6000000b00515cfc0e324sm1231930lfo.237.2024.04.08.10.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:12:17 -0700 (PDT) Date: Mon, 8 Apr 2024 20:12:16 +0300 From: Dmitry Baryshkov To: Guenter Roeck Cc: Greg Kroah-Hartman , 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: 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. That's sad. > > 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. And this is good from my point of view. If I remember correctly, initially panic-on-warn was added to simplify debugging of the warnings rather than to disallow using WARN_ON(). The system is not supposed to continue running after BUG(), so panic/reset on BUG is a safe approach. But the WARN is different. It means that the system was able to cope with it. And as such there is no need to panic. Whoever enabled panic-on-warn is doing a strange thing from my POV. -- With best wishes Dmitry