Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1327014lqe; Mon, 8 Apr 2024 06:06:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWL9IHQ3JqbKB1bM1pWkCkEjos3gyEyKJCEcJPyI+SlOHf7si7MXizOnpP0l1UjhL4rnvO6x8PXVqkZssdnsxnJ9jhUlaX9SlavYS4g9w== X-Google-Smtp-Source: AGHT+IGDQwRbX/wtGdS724Fqf3/TtuRRIdPUShTHrhGXF67b0ugw6ZDZzgYp4fwjDiBEkCti7Xwm X-Received: by 2002:a50:9f87:0:b0:56d:f0da:cc11 with SMTP id c7-20020a509f87000000b0056df0dacc11mr6654185edf.12.1712581585974; Mon, 08 Apr 2024 06:06:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712581585; cv=pass; d=google.com; s=arc-20160816; b=sox04NguiFJRQTUXj6jQkCJFtnWgorVrxGSQA6Br+WXkFySjbMulqvsMN2gvJEeINb o0ouBYkoeYKWIYFTY5TXeilV8IBTvrft2zFFlvMzjSq9QgqWTIaRrf1NmzukJjG0lxWd U2jEdgdjIdSN8mPVOKVcqU1rDvtWrqDp+PUnzfHWQISnO+1Ph7J9y7PL/QJcIyXu/B7t ae9HJnh7hqvg7xZ2qZnQyhFhLMDymBZqRF3M3MedA8sE4BG6T4Tuv60lKRSuOiIsX/PP /v9HdYmvv27eLR/Y8GM8Qh7vdbjhjcA88OisA8R3Q+HLgjWGjUJqL5oJCvvj5uIDZRWX t7fg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=TVioy9EMNQnc5SXcQapeY7Z9K+iAa8Z5L7a/jg+l4cY=; fh=OLE4ojA54R6c9MyaMcbUu0KFt4HVlz2Vm3R/yMALAJc=; b=EHpMuJ3aMlSmPz/5GaaS/i5fvvea8lii5ON3Gowuz9AtoPgMmKhJjqgyFfO31tX2pc l2HR2DBmwW1RhVvMgYRx+IE/MwJWsrgxZjvPpR0MBGReQQ8FwJV1OTY2aLLm0MiFleGk fSjaziIXG53e4ueJuzmAREZzwu4FiJpMi3GzcdkOxxht6I14y9W/8Z0pe3WmIncscj3q Xh9zT9kxKRVr7cwx5pZK52ti3Y5zJNVLJ7LTSXtZmBZ9O7Na0SNixjNq15tEF503drMF CZWeyBOKGy9uqsXbe/BY5jRhibMW0+ueoEkzcA/a63uBsdHs8xTCt3mqxMevPf97KWoH IBbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="V6V/JtZx"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135386-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c11-20020a05640227cb00b0056e05f2c1e9si3837059ede.272.2024.04.08.06.06.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 06:06:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135386-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=@google.com header.s=20230601 header.b="V6V/JtZx"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-135386-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 7E9B21F24B64 for ; Mon, 8 Apr 2024 13:05:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B08BE7442A; Mon, 8 Apr 2024 13:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="V6V/JtZx" Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 390FB7D096 for ; Mon, 8 Apr 2024 13:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581479; cv=none; b=D8XYiplVYeWjEn/Tf4vFMSXf4shKZ5w3CPLaazeam4AyuQr5l6a4I26FRJPIHN6dxl/eU7cxNwZjLGDGPzn7bF0p5mqz8lBF41fQAcEA2yESI1EjVwYr35KM76M7g0jztxaCgFcDmeIhamZZANAzkzTULgxsaucMaWVwhA0FKyQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712581479; c=relaxed/simple; bh=7bpRSGGPDQCS7wFqBB78vDQoO6pcgett9EASBZ5btWM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=kreP4RidDVCafM9ON+lTX0bKbHmRKGg4K8B/LbDCemu8J0gEf9f2nJbDR/Hqj0Z9R0dnNY7Gw8p6HzMqH6LIfxejjfl0HHYIj9wA14KIsswvcqvKSvebWSEde1E7uuviajZi1plsS2CSz0AbviVlJOvLg2uojKVGmYlxrb0x1mk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=V6V/JtZx; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-434b5abbb0dso144071cf.0 for ; Mon, 08 Apr 2024 06:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712581477; x=1713186277; darn=vger.kernel.org; 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=TVioy9EMNQnc5SXcQapeY7Z9K+iAa8Z5L7a/jg+l4cY=; b=V6V/JtZxF+/LndpdhRmbOuo/U1EUSxttljOGzrE+EYarMRJhqEEIgiDu4CsM1Rtzgc Bn4ku4kJdDrpz3KiK4Ie+zt0mKIB/PTxj5/LDT9Ijr4jydu/cCGGmGNhnaAEtyqn3Jqx OAsgszri7Xgg4E4q5vSKJ9TK8odjahLuUIrdoUIicGTlf2snFgCpWJEfYItZSkk8JmhW hb72eE2ANh9jW4ca6uH5jCx20bmxaOPzi2kTZcLWCovCiW0lri6J0lOWG46jNZTnsU+a /TakSItP2mKngyv4cbTTctHtPLKHRhaE5+J++vrA6fe4dtZ76iWAL2f/rtjUOOJGTvJJ Z67w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712581477; x=1713186277; 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=TVioy9EMNQnc5SXcQapeY7Z9K+iAa8Z5L7a/jg+l4cY=; b=kz4ModCiMVla1At+wusxsdAbdOIWfDGyxDTUqpVQSpaIrEK5h6nEjkiCGNV0PJj3qp v6ATL6tA7n3jPRIWI/yc8lGLxZEHzbgbnSPnWFu1BBFkWXrX+mUrL7Y+V+rFd0ufOzsj diztGiq/2hmtWN5wi52uBy6izsMWJdAj9I3A6oBAhFHkTPSWGotyNr5fXoU5E8tV7BP6 H48V5pxaud+DHS1Q8z/7cdTPJ86WP5+Xyr3gBLFvuJDtKTw8cgdTdv2ddqx4KEjly+jb TXqdQFXjvnhWQhft385bGAQedhYB3ygrmN92Pj4ucLwV20CGiZXo10Lb1zxhpgBw24ZE ZNFw== X-Forwarded-Encrypted: i=1; AJvYcCWv8RsN5dXgPtHhLeK2d6o1Q6xnPgps/Zlk+BYc/Ry8D902/C0YbJ8tx2I9JD08PA/WAZ9XAhoXrFDTNAgYoCivwfTVPs/gkSV/HEyW X-Gm-Message-State: AOJu0YyV40mYEwjp1GBMahYpRHz9IawylSad2fJW0snIM/pTqFyNyRgu TeYT9cLLL37FtMPn0+aPJtd+A16bozZfPsBFcYxTCtJfVmHNxK5kDPoY7f+ifohLx+mvP7WpLW0 lXmU/xRujOaUjk3wqUYfokxhx0DtpqpRmlYO1 X-Received: by 2002:a05:622a:4812:b0:434:7bb9:f231 with SMTP id fb18-20020a05622a481200b004347bb9f231mr343464qtb.12.1712581476934; Mon, 08 Apr 2024 06:04:36 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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> In-Reply-To: <2024040422-ripcord-bladder-bdda@gregkh> From: Guenter Roeck Date: Mon, 8 Apr 2024 06:04:22 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] usb: typec: ucsi: Implement ChromeOS UCSI driver To: Greg Kroah-Hartman 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 4, 2024 at 6:30=E2=80=AFAM 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. 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. Guenter