Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp286766lqp; Wed, 22 May 2024 04:53:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWK1OP9+eQ8oY+6Cns0lXJtbwlY/o1cqHLX4rFEY/HfPg7e7kxUxCaW6FbcBaD98TTyorw+SS81q0oYtG8WIjJXAf3awYBZaDPl2dQb0Q== X-Google-Smtp-Source: AGHT+IFKPxDGeo4zu9r9Ds6C+otmD4G9nH960idlIZHKJCcVAkc6MCPXguJaiP/iqqRupDPOcb3w X-Received: by 2002:a05:6214:3116:b0:6a9:98a9:88d9 with SMTP id 6a1803df08f44-6ab7f358590mr13928026d6.17.1716378798238; Wed, 22 May 2024 04:53:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716378798; cv=pass; d=google.com; s=arc-20160816; b=jHYWVXu10xBLYG7IdOTJ7F8eCckLv52uAJ8FFRjSHBdlnGym6ZVi2ADC6XYk/WtsOx bdJaSDSLawvRaAU4mj5rDgCpTkhLmZsBo0IjwZp0RwQgbeAfwJurHLP1heCEMOi3fBfd 7BObGLqedHPGf2KS3OMD2LstncPCnVJza0DJ7fkDjHiGpBr3ivu9fF5JEihEDxJIWeJy sk6UPUeqotU4m4904QY241qaKlRP/4tgxabo7ntizkqmKyLWvII5uIS9RZkgwV5lYK+B dG13WqIel2iOGpawEUmZfsdr+06wj+so3GSpV60EYUAWUuk8mx4XIHB/REz0ZAFIJYyl R0vw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=lZc9L8nSVEY9ZvVjEf6riakUMqbgRISVhXQ6LxB8KeY=; fh=UKXhhWUdRzIg2hiM2ZjysFsY3VR8KJFfDOwp2zyR08g=; b=Ujeomoga5erKC2Ys7o6h/EtJDKV2tI+r/ku8NT1Cu3yGt1O9FSr2jxzrT8ZxVvauk4 rvYCJWFMNOwi1R9oQ1lYa81jJWc2a/LFbcGHxt9ec6kB3fuAjlADrdl8nyWBiLKK5fN1 RtYKs7VQdhZvwBdnwGMkCXJSKbupIrbCz5EprfzKJ1kEcA3S12ezE7swN15zrawBqFhZ xpZLGnMlTUA7FMlNyyD7LZS744byNqxmXBrFQApjwe2KBmw8mKfVmhDuxrDSCF0gmqGl n05pgwYNrF7pdX+SMgor+kqDEH5IT8k5sKxfEAuUjg/M8Cjpa5qx7salAieqUiHBhZ3M Z4tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TaayML6I; 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-186177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186177-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 6a1803df08f44-6ab6fe24feasi36451486d6.131.2024.05.22.04.53.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 04:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186177-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=TaayML6I; 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-186177-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186177-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 D05341C21A6B for ; Wed, 22 May 2024 11:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70D0C13D53B; Wed, 22 May 2024 11:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TaayML6I" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 C7EEF757FD for ; Wed, 22 May 2024 11:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716378790; cv=none; b=dE33Oze44z/edh7Sc6e8SlNdvNvJcYpFYWB4Uqq1qoJRTojEQCQNKsSVVD5fCghHuP49AD+oyoAH4LVMIhk5fi1IKMbTqKRKAFiEBJy4nL/GinB9WxvBhA06b++PgiRQ47yXtMOT9oSfqjCxPmEkpFFSki9O3PUj28a2mTM7tDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716378790; c=relaxed/simple; bh=WXZH/yz80gYFyQ4BbC/w5IyTTWDKcC5KranzjFiKEL4=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=S+EAk7t089CZmmrfHXrO585feh9zKgFUqEse4UNBFk7Seo7QoeMl2gY3ksR+F77f4rnHyLg4CHhsO2fuolLo+aZmJNkX+s4v0z0alECWO8W5FBjG5Kf8Hts2X0ltqxUthz0kEPtmLiIlmK53Q8HTRNrf8yqAMFhY2WyCEnjJUGo= 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=TaayML6I; arc=none smtp.client-ip=209.85.218.50 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-ej1-f50.google.com with SMTP id a640c23a62f3a-a5a0013d551so550435066b.2 for ; Wed, 22 May 2024 04:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716378787; x=1716983587; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=lZc9L8nSVEY9ZvVjEf6riakUMqbgRISVhXQ6LxB8KeY=; b=TaayML6II0kHHVHrWwLC5JIM8ff/LcVqw6r24NFCuCaSgQ1eYUa+WMnVM+X9xy4chK o9t6bm6hxUd4QasRmKMFnEkStBch/BjtELV5IJsA20qiDlD6S9bOV0axKgH5hzk/UAwr IwoX60u1+z4F22y1nj9yeRk39ZmXHo834GjnAcLMtmxOdb7kGmcVFE57SYLcdEZiLgn5 KZwK9XbV/MRBCGo0pgygZf7aa2saS06trCdtmaP/UcEuOy1YpjSykt03m62SSKBgz49s CwqsikpAlSU0PiNt3HodvSFvKf/oBCR0BMJoOGkQICozATjVxmXPCRqovtBPhzT5EG2S cxyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716378787; x=1716983587; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=lZc9L8nSVEY9ZvVjEf6riakUMqbgRISVhXQ6LxB8KeY=; b=LYoRbpRW1sOfxEBKQRLscf6KTmcLJb15TLA53c9lUELht45cJ2q9Vn/qoMfD+6pJtC ReQRNXZdTbgJAAMZKnJmgfqvoHmL5AGimcfQIuvsFC+Z/opDYC20g1PBNAj3N2NiMFSC jqlX4Na9GZkd0RvASfmLYYlMe48P+qCRr/sH6Fjo4ElA/WtHGBuBg+fv88LWZYn0CPbe yPGP2v7GNJTBjo3IVBZp6PDmLO80HiX5wyhthiUtJYkkDPGQxlFdSMm4kn+GDKVs7sIr kVob6NSA9qFEhxsDKPBEl4iE9VtodpPPKg5CgpHXWwclvoa5NN2zW8Yh7fOYDN3sThCy 5ECA== X-Forwarded-Encrypted: i=1; AJvYcCVcMPpKSj9xrc67LSZwZYK0jR2PlkXWnu6NsPaaK2U/7U9PjMJFUN+05rwRQyoD1VIQheRZH31J36sswzU/phDTC92akzO6qi0SETaq X-Gm-Message-State: AOJu0Yz7QhkA3nfu648HegFowRZSvGfO4xVPvW64i6xQ+nkB+8kpKBFB S4TIr1n68M8U8+7l4YVTYbP6ZnG5lZ6vvot3JytPZSimEZJdn/MVdslBEl4NgS8= X-Received: by 2002:a50:cdcd:0:b0:572:7d75:a70e with SMTP id 4fb4d7f45d1cf-57832a8c715mr1390052a12.25.1716378786998; Wed, 22 May 2024 04:53:06 -0700 (PDT) Received: from ?IPV6:2a01:e0a:982:cbb0:8b9d:52bd:4757:6b10? ([2a01:e0a:982:cbb0:8b9d:52bd:4757:6b10]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5751ada828esm7285640a12.62.2024.05.22.04.53.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 May 2024 04:53:06 -0700 (PDT) Message-ID: <5c32d7fd-4a7f-4d9c-805c-87d4d14f741e@linaro.org> Date: Wed, 22 May 2024 13:53:05 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Neil Armstrong Reply-To: neil.armstrong@linaro.org Subject: Re: [PATCH v1 1/1] spi: Remove unneded check for orig_nents To: Andy Shevchenko Cc: =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm References: <20240507201028.564630-1-andriy.shevchenko@linux.intel.com> <8ae675b5-fcf9-4c9b-b06a-4462f70e1322@linaro.org> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAHNKk5laWwgQXJtc3Ryb25nIDxuZWlsLmFybXN0cm9uZ0BsaW5hcm8ub3JnPsLAkQQTAQoA OwIbIwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgBYhBInsPQWERiF0UPIoSBaat7Gkz/iuBQJk Q5wSAhkBAAoJEBaat7Gkz/iuyhMIANiD94qDtUTJRfEW6GwXmtKWwl/mvqQtaTtZID2dos04 YqBbshiJbejgVJjy+HODcNUIKBB3PSLaln4ltdsV73SBcwUNdzebfKspAQunCM22Mn6FBIxQ GizsMLcP/0FX4en9NaKGfK6ZdKK6kN1GR9YffMJd2P08EO8mHowmSRe/ExAODhAs9W7XXExw UNCY4pVJyRPpEhv373vvff60bHxc1k/FF9WaPscMt7hlkbFLUs85kHtQAmr8pV5Hy9ezsSRa GzJmiVclkPc2BY592IGBXRDQ38urXeM4nfhhvqA50b/nAEXc6FzqgXqDkEIwR66/Gbp0t3+r yQzpKRyQif3OwE0ETVkGzwEIALyKDN/OGURaHBVzwjgYq+ZtifvekdrSNl8TIDH8g1xicBYp QTbPn6bbSZbdvfeQPNCcD4/EhXZuhQXMcoJsQQQnO4vwVULmPGgtGf8PVc7dxKOeta+qUh6+ SRh3vIcAUFHDT3f/Zdspz+e2E0hPV2hiSvICLk11qO6cyJE13zeNFoeY3ggrKY+IzbFomIZY 4yG6xI99NIPEVE9lNBXBKIlewIyVlkOaYvJWSV+p5gdJXOvScNN1epm5YHmf9aE2ZjnqZGoM Mtsyw18YoX9BqMFInxqYQQ3j/HpVgTSvmo5ea5qQDDUaCsaTf8UeDcwYOtgI8iL4oHcsGtUX oUk33HEAEQEAAcLAXwQYAQIACQUCTVkGzwIbDAAKCRAWmrexpM/4rrXiB/sGbkQ6itMrAIfn M7IbRuiSZS1unlySUVYu3SD6YBYnNi3G5EpbwfBNuT3H8//rVvtOFK4OD8cRYkxXRQmTvqa3 3eDIHu/zr1HMKErm+2SD6PO9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 22/05/2024 13:33, Andy Shevchenko wrote: > On Wed, May 22, 2024 at 12:03:33PM +0200, Neil Armstrong wrote: >> On 15/05/2024 23:09, NĂ­colas F. R. A. Prado wrote: >>> On Tue, May 07, 2024 at 11:10:27PM +0300, Andy Shevchenko wrote: >>>> Both dma_unmap_sgtable() and sg_free_table() in spi_unmap_buf_attrs() >>>> have checks for orig_nents against 0. No need to duplicate this. >>>> All the same applies to other DMA mapping API calls. >>>> >>>> Also note, there is no other user in the kernel that does this kind of >>>> checks. >>>> >>>> Signed-off-by: Andy Shevchenko >>> >>> Hi, >>> >>> this commit caused a regression which I reported here: >>> >>> https://lore.kernel.org/all/d3679496-2e4e-4a7c-97ed-f193bd53af1d@notapiano >>> >>> along with some thoughts on the cause and a possible solution, though I'm not >>> familiar with this code base at all and would really appreciate any feedback you >>> may have. >> >> I also see the same regression on the SM8550 and SM8650 platforms, >> please CC linux-arm-msm@vger.kernel.org and me for a potential fix to test on those platforms. > > There is still no answer from IOMMU patch author. Do you have the same trace > due to IOMMU calls? Anyway, I guess it would be nice to see it. Yes : [ 6.404623] Unable to handle kernel NULL pointer dereference at virtual address 000000000000001c [ 6.641597] lr : __dma_sync_sg_for_device+0x3c/0x40 [ 6.688286] Call trace: [ 6.688287] iommu_dma_sync_sg_for_device+0x28/0x100 [ 6.717582] __dma_sync_sg_for_device+0x3c/0x40 [ 6.717585] spi_transfer_one_message+0x358/0x680 [ 6.732229] __spi_pump_transfer_message+0x188/0x494 [ 6.732232] __spi_sync+0x2a8/0x3c4 [ 6.732234] spi_sync+0x30/0x54 [ 6.732236] goodix_berlin_spi_write+0xf8/0x164 [goodix_berlin_spi] [ 6.739854] _regmap_raw_write_impl+0x538/0x674 [ 6.750053] _regmap_raw_write+0xb4/0x144 [ 6.750056] regmap_raw_write+0x7c/0xc0 [ 6.750058] goodix_berlin_power_on+0xb0/0x1b0 [goodix_berlin_core] [ 6.765520] goodix_berlin_probe+0xc0/0x660 [goodix_berlin_core] [ 6.765522] goodix_berlin_spi_probe+0x12c/0x14c [goodix_berlin_spi] [ 6.772339] spi_probe+0x84/0xe4 [ 6.772342] really_probe+0xbc/0x29c [ 6.784313] __driver_probe_device+0x78/0x12c [ 6.784316] driver_probe_device+0x3c/0x15c [ 6.784319] __driver_attach+0x90/0x19c [ 6.784322] bus_for_each_dev+0x7c/0xdc [ 6.794520] driver_attach+0x24/0x30 [ 6.794523] bus_add_driver+0xe4/0x208 [ 6.794526] driver_register+0x5c/0x124 [ 6.802586] __spi_register_driver+0xa4/0xe4 [ 6.802589] goodix_berlin_spi_driver_init+0x20/0x1000 [goodix_berlin_spi] [ 6.802591] do_one_initcall+0x80/0x1c8 [ 6.902310] do_init_module+0x60/0x218 [ 6.921988] load_module+0x1bcc/0x1d8c [ 6.925847] init_module_from_file+0x88/0xcc [ 6.930238] __arm64_sys_finit_module+0x1dc/0x2e4 [ 6.935074] invoke_syscall+0x48/0x114 [ 6.938944] el0_svc_common.constprop.0+0xc0/0xe0 [ 6.943781] do_el0_svc+0x1c/0x28 [ 6.947195] el0_svc+0x34/0xd8 [ 6.950348] el0t_64_sync_handler+0x120/0x12c [ 6.954833] el0t_64_sync+0x190/0x194 [ 6.958600] Code: 2a0203f5 2a0303f6 a90363f7 aa0003f7 (b9401c2 Reverting 8cc3bad9d9d6 ("spi: Remove unneded check for orig_nents") removes the crash. > > Meanwhile, I have three changes I posted in the replies to the initial report, > can you combine them all and test? This will be a plan B (? or A, depending on > the culprit). > I'll try to apply them and test. Neil