From patchwork Tue Feb 20 22:58:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 203844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp710658dyc; Tue, 20 Feb 2024 14:59:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVeA+ZGPBwISc0cEBr3AuKBJakJ7FYCug4NLk9/H8Ouh3c5M31TYGlnrrM8AVj4bJjNO8ihzkiBLvU+DYXkCTnXBxwnOQ== X-Google-Smtp-Source: AGHT+IFJkbOqKPjvikdl8eccDQifGUAB4wv3AGAOK46TiGkuWYVost6+JR9VAcwwVA9g1sSOYbkv X-Received: by 2002:a17:903:22ca:b0:1db:cbff:f7d6 with SMTP id y10-20020a17090322ca00b001dbcbfff7d6mr9809162plg.44.1708469982394; Tue, 20 Feb 2024 14:59:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708469982; cv=pass; d=google.com; s=arc-20160816; b=V5lEOv/RprAIR0SgG2Z3MK7eOS4y7Nb/+hZegr/mv+g8wtymff+mckSMlhO1a8Ucrd p7Pv7A8amcahjkzr58N0HTpwLuOEYNwPIa0sjY2DS/rxWKXEuVo+hWreujZ2OJJALEKy MwrhXLBkZSlIN7DXJmcfs9FDpYBBHeajhyGhB9Jus/6OleeB2jd02JDQ0g0J9fOxl/A5 nyePKv1UdxJY5Na9uyXGbh8kKuk7/pDHUpYV2D9GdfXT0RXIR2lN2VelbXPh8db/iR0x JtirK+FZONYZojVbBuQvlxDK7lKkqfqI6hQDWC3xzK9pLGZTXXI72wOs0jxqDUbRGN4c eKIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=TUcIEfTpYZcXd0dHJfdR5ASrz4snMW6xTMGC+3CDi/Q=; fh=+/vPNl/IoFxqEYgW8/ALtVHi6rLHZYX1svzcu7mC3bo=; b=KlBQVR/JO4ZSF46IfHqhgD909muJOqm6iVW+TGgX2hx0jmvpvxOKdSZQuo4MTWvkJ1 csYPd7Q3VQLsJnThNtIFszegfXBkJ0uspzVcFZZhbfhLf3l/2iDBCm5U6UZrYk7ny0jQ rwiW5IpTaDsyNiB6hbpCeHcuoQe23t469rPm8+tyImuzlXT3fE84B2a9BTbicRsPhgK1 xgezzkI7RTVbBhdRP37ALFetxw1Ym2hg7gSerXk5fvpiHB2K66vcFZ2Y0IUixhGwaOX4 Cm3Fy7RR9WSeluLVTAKQQFQqx0HB1eP/TVm8nnPe4/FWeuZ3qCeNcO9KJiUzfViJHdxQ Vs9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gdzK+hfx; 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-73793-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73793-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k12-20020a170902d58c00b001dbe5ff0d33si5077935plh.491.2024.02.20.14.59.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 14:59:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73793-ouuuleilei=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=@linaro.org header.s=google header.b=gdzK+hfx; 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-73793-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73793-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3CB1C28439D for ; Tue, 20 Feb 2024 22:59:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 240D8154C07; Tue, 20 Feb 2024 22:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gdzK+hfx" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 8FA8F154BE3 for ; Tue, 20 Feb 2024 22:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708469929; cv=none; b=DjzUFbabT5g1fkfnTPNkEihex7D+iiBxPj31cYK6egEyj+UIIOVo38ZYCpl5fTwDLf0oU0RP5BhTQO9w+JphoT/eLHDKy5W5sJXnsn2ZUv+I441jdBjHWOyqhK/KIHQVHo3woHbTOVIRyJbed5dn03eAX3uDtkitLPIYV5QvU/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708469929; c=relaxed/simple; bh=2KMavfot7dn/jSlYRp4vCD7QcIkkOuyAV9KqDkyaykQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=UsAcGGhE9jsBTx8n2+PJkiyZY5dDPo/chvAbUtquAetEqrgeb1/ydz72DFYE/A1QlxdhIyPFKEngvotcPxuifKGt/lEq4z5Mbzo+rT6lom+eXUn1HNQHQaaz2OPJTC/eKiFWIlXnbp7+x77eiCK/F4fTrEQ4gpI8O1b03vC1PX4= 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=gdzK+hfx; arc=none smtp.client-ip=209.85.218.54 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-f54.google.com with SMTP id a640c23a62f3a-a36126ee41eso799099666b.2 for ; Tue, 20 Feb 2024 14:58:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708469926; x=1709074726; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=TUcIEfTpYZcXd0dHJfdR5ASrz4snMW6xTMGC+3CDi/Q=; b=gdzK+hfxp3w//WJXkZf0jhXFjBXCszr82lsBlru4jGHjsZixGxF/FMG39fjEoQlR6p JbcZ70CSIK1KcZKxcp6kTnh6LMmENu8Hq5a0smyGD01m1qiNs3MT1QkXiTmqBIR8vhv0 PajGMh8NmCv/TDVCjLxi7eOxeFnXqt7SWRXzwphZ9QOz2/5/hqFMU20XQ1kO3+TIGuQc Gt8zK0K4MT1UyvvPqnB7lREYMs8yBjJnt56ckAQUjB/AFvk8dCMZllJ2pncaaSUdohlZ tAhQFZiRzGVRkpz08R/Y4TJfAIUjY9CmRA0T8ZBXwNtrDH17/ZBYAiQJrgWYwqxuDHxv 271A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708469926; x=1709074726; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TUcIEfTpYZcXd0dHJfdR5ASrz4snMW6xTMGC+3CDi/Q=; b=YVssxHeIgGqWnN8TGdbG/An6NObLefgSYACncMGeRWAZXEFI99367wrPpWIf214+BW 2fakaPNFEK+YZ+imTihXsOntlabARcvdmzKiTXeWBJexJndjZS9l9IgAq0bdmf3iVZDL yRXIFpFwI1rvRz7m+d9C3yGSi8O0OU+rDsRpgwcc5p0Pq3cq0QyBi5PbWnBxnVS9CpHs V/f5iZFJP3AcDGfmqqR4Tt4h9cRoGr777vYVhA0yUDTlLsP1OkjBLu4Ia4pQKK5Ncmpj cAcbsmhYBzTclAMadAKMOXDaMyDejstKWmccPCHfIMXbd90+qV0WhrGof42pkrlxQ7ix c0RA== X-Forwarded-Encrypted: i=1; AJvYcCUifXE9Lek7DlgqWQlXYNxXSozHEPFx/z5grryNiwFTlC85xxBgPvBjGWkd+WlkWyX0XuxB8avXfp47RujSpQ6m75QwEq4nJ7ohVWj0 X-Gm-Message-State: AOJu0Yw6YBnKsU5H+zYHVFUHbiKfKaCiDUF2KFeJa1joMlZFgbvCKWCW P89y8iDMrXAyWIx3vFg8Ak/wdaJRj8xcv17KBCH5eXfE7HJfH2HGO1UkiKVXKYk= X-Received: by 2002:a17:906:e2cb:b0:a3f:175b:ea91 with SMTP id gr11-20020a170906e2cb00b00a3f175bea91mr1274492ejb.13.1708469925781; Tue, 20 Feb 2024 14:58:45 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id tb5-20020a1709078b8500b00a3d599f47c2sm4417614ejc.18.2024.02.20.14.58.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 14:58:45 -0800 (PST) From: Linus Walleij Date: Tue, 20 Feb 2024 23:58:45 +0100 Subject: [PATCH] mmc: sh_mmcif: sg_miter does not need to be atomic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-fix-sh-mmcif-v1-1-b9d08a787c1f@linaro.org> X-B4-Tracking: v=1; b=H4sIAKQu1WUC/x2MQQqAIBAAvxJ7bkHFkPpKdChdcw9aKEQg/j3pO AwzFQplpgLLUCHTw4Wv1EGOA9iwp5OQXWdQQmmhlEDPL5aAMVr2qGcrHRlhp8NAT+5M3f+7dWv tA64RybheAAAA To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Linus Walleij X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791460620600126056 X-GMAIL-MSGID: 1791460620600126056 All the sglist iterations happen in the *threaded* interrupt handler and that context is not atomic, so don't request an atomic sglist miter. Using an atomic miter results in "BUG: scheduling while atomic" splats. Reported-by: Geert Uytterhoeven Fixes: 27b57277d9ba ("mmc: sh_mmcif: Use sg_miter for PIO") Signed-off-by: Linus Walleij Tested-by: Geert Uytterhoeven --- Hi Geert, it'd be great if you could test this! --- drivers/mmc/host/sh_mmcif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- base-commit: 2d5c7b7eb345249cb34d42cbc2b97b4c57ea944e change-id: 20240220-fix-sh-mmcif-49c1de70c5b7 Best regards, diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 1ef6e153e5a3..669555b5e8fa 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -607,7 +607,7 @@ static void sh_mmcif_single_read(struct sh_mmcif_host *host, BLOCK_SIZE_MASK) + 3; sg_miter_start(&host->sg_miter, data->sg, data->sg_len, - SG_MITER_ATOMIC | SG_MITER_TO_SG); + SG_MITER_TO_SG); host->wait_for = MMCIF_WAIT_FOR_READ; @@ -662,7 +662,7 @@ static void sh_mmcif_multi_read(struct sh_mmcif_host *host, BLOCK_SIZE_MASK; sg_miter_start(&host->sg_miter, data->sg, data->sg_len, - SG_MITER_ATOMIC | SG_MITER_TO_SG); + SG_MITER_TO_SG); host->wait_for = MMCIF_WAIT_FOR_MREAD; @@ -710,7 +710,7 @@ static void sh_mmcif_single_write(struct sh_mmcif_host *host, BLOCK_SIZE_MASK) + 3; sg_miter_start(&host->sg_miter, data->sg, data->sg_len, - SG_MITER_ATOMIC | SG_MITER_FROM_SG); + SG_MITER_FROM_SG); host->wait_for = MMCIF_WAIT_FOR_WRITE; @@ -765,7 +765,7 @@ static void sh_mmcif_multi_write(struct sh_mmcif_host *host, BLOCK_SIZE_MASK; sg_miter_start(&host->sg_miter, data->sg, data->sg_len, - SG_MITER_ATOMIC | SG_MITER_FROM_SG); + SG_MITER_FROM_SG); host->wait_for = MMCIF_WAIT_FOR_MWRITE;