Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp565058rdb; Tue, 23 Jan 2024 07:58:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHo+2ve8JzIYFebVoNO9O3J0luTpk/VHs3ZPBBgX/NU2TKcn0kWvBQ2P7H3hJjgVowkwDnL X-Received: by 2002:a05:6358:3101:b0:176:543c:8ef0 with SMTP id c1-20020a056358310100b00176543c8ef0mr2878894rwe.21.1706025511676; Tue, 23 Jan 2024 07:58:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706025511; cv=pass; d=google.com; s=arc-20160816; b=f2GBPRmshvMl8ysdL5v6LISO1mOF38GxJV2mciUooNhOFeipRZVbp++t5QlQmbYli7 LBK87D1W5jAxS2RSlr3bXL4+Vv6mQO5Ynk0wKWJ8Iv47vTLulwoqrXXlCCBSpko3wtQe hjIyXxXu7F6FNqn/HAXL6pFn7kNO4PtJEC7H9oqYZCwv2TgfFi88bMkH9ECvIe9yuHUE 4251WjVQz1Xyxsy+Rmy5Lm3XfS3pEFjEfSNZLn5064IZxOj1bXmc13g6Zq5Q7vPIe++L yNoVuOkh8tJKIGUCVQOY/ieYEILkoRWfU6VIGBxEs9JgsMPxAI8So5tRFD6VUnHeGssn sPPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JUuUnFDFUMALA36+GlPkk/pGx33N4O0srUTkt71nu2k=; fh=k24ce8XGv3mmAxEAVljVbB700yPmopJJBED6fgZ0NLw=; b=nC/+tH9FMBaImEsnMVaJ9O3qz8JaEh+drxo+U+C0i/lW51NQXYuA7a3iq1qPLJmYGo HVjOdTc1vt6vK53ZDSfcee31HmOvRpz0kxQ4kgBjbmj5oJytyIvyoXzikl/74cjuFbil i+ilbgixdbe+eBSjrnXHzV82THqP6sEBHcjK2NYCVz1BN5AeJ51IQ94ojAJQ16yzdzJr QYfkjSHT3i1YgEtWdc2VRsESYFAwHLVh5V0NoNRbt5dyDLIh88pg7yCgT1coyysh5riN cOeSMVLs0u3DncLDj9ydWzIVTwPGWgcZz8uGmQ6eJilHhOFqsOS5ZAEPzghp71yK1vpQ f0/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BRy2exoP; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-35596-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b14-20020a056a000cce00b006dbdf5e3c25si3893746pfv.282.2024.01.23.07.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35596-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BRy2exoP; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-35596-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B7ED28ECE7 for ; Tue, 23 Jan 2024 15:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F65460B90; Tue, 23 Jan 2024 15:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="BRy2exoP" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 B721B60240; Tue, 23 Jan 2024 15:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706025152; cv=none; b=E+LxCRNUIKkZlsNjRgRb+yX4yunKYUnjMrC99zsBmaKqqVFrCbKZphcQM1ZNxkJuvOJqZJvnQQQezU2ac7CzdPzT1xHiglSsdsucvrBlCc/o/AW1yI9kA6k0r4CLyLDA9/f5IVRjOMdpfPOXn+S8SIcICF2wSGSwHCo7iSRrlMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706025152; c=relaxed/simple; bh=lpOn925ITeoxcbmE2jG+i+i7BL7X1pvC6JLxC8iCIfA=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kjMc16D6BeUSvlYJCIiyHKgXjuIYfm4yAbJPJH3gBMwJD3pOYAmmirN/Y4+dsJxQTYcDPSfg1IMRTI7ROKWs22yHFv9GRzJ/mN0SV0R5dFJSpMMKD3zzD/y58KS0AKxV7P+sVeKR/FAwh+pre/whlBk+CxLtxONVEgiUgjDP9Ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=BRy2exoP; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40N8KGt5022570; Tue, 23 Jan 2024 15:52:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=qcppdkim1; bh=JUuUnFDFUMALA36+GlPkk /pGx33N4O0srUTkt71nu2k=; b=BRy2exoPAyDT44drpP3ByWRIZmJSvzC2Ea961 WH1zpDAhLNZn4HbCkr0ePZg9xPpIcGlu5wtKlk75h9v+w1gK4Ep9ceKOhqLmcrVs N+sDpjaaAKJ6xhHZE8T3TaOSbbx7GCBvDxt3RNQqwLhUtuzAiDU9v9sFNXaSQSzt 1RCvz3syJjXnFBxURyZ+jQh9wKW7pAv9lovEaVvDmXwGfYrkA1BgYo2drnZ4hliQ dKSut48nO/WCXsqUIEz5BD+P7US+OUuDq7CLV1lE7c/CCwR1KEW7Cp1YW34v7e8D 49xTYWXKAl6dD0Xhc9gcelySBAq11ODtP0hR8tiInH5O3X8Sw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vt9un945s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 15:52:12 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40NFptAF030744 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 15:51:55 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 23 Jan 2024 07:51:53 -0800 Date: Tue, 23 Jan 2024 07:51:51 -0800 From: Bjorn Andersson To: Joel Granados CC: Huang Yiwei , , , , , , , , , , , , , , , , Ross Zwisler , Joel Fernandes Subject: Re: [PATCH v3] tracing: Support to dump instance traces by ftrace_dump_on_oops Message-ID: <20240123155151.GE2936378@hu-bjorande-lv.qualcomm.com> References: <20240119080824.907101-1-quic_hyiwei@quicinc.com> <20240122135645.danb777cc5e7i77z@localhost> 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="us-ascii" Content-Disposition: inline In-Reply-To: <20240122135645.danb777cc5e7i77z@localhost> X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: Zjlep91INoG0IKDkPXiFIGEo11yVSWoo X-Proofpoint-GUID: Zjlep91INoG0IKDkPXiFIGEo11yVSWoo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-23_09,2024-01-23_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=613 priorityscore=1501 adultscore=0 clxscore=1011 spamscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 impostorscore=0 phishscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401230117 On Mon, Jan 22, 2024 at 02:56:45PM +0100, Joel Granados wrote: > On Fri, Jan 19, 2024 at 04:08:24PM +0800, Huang Yiwei wrote: [..] > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c [..] > > +enum ftrace_dump_mode get_ftrace_dump_mode(void) > > +{ > > + if (!strcmp("0", ftrace_dump_on_oops)) > Would using a strncmp be better in this case? And this question goes for > all the strcmp in the patch. Something like strncmp("0", > ftrace_dump_on_oops, 1); when they are equal, it would avoid 2 > assignments and two comparisons. As you determine yourself below, Huang is looking for the string "0" not just something with the first character being '0', so you you need to check for null termination. > Also might avoid runaway comparisons if > the first string constant changes in the future. > If the constant suddenly isn't null terminated, causing strcmp to run "endlessly", we have bigger problems. > Or maybe strncmp("0", ftrace_dump_on_oops, 2); if you want to check if > they are both null terminated. > This is just obscure. At best it would confuse future readers. Regards, Bjorn