Message ID | 20240221-fix-sh-mmcif-v2-1-5e521eb25ae4@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75517-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1305606dyc; Wed, 21 Feb 2024 13:23:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW/nBLePHwJaWD4FbAgyX5LQChZ5tspEZvkQiT1F5t0ONimzFqGx0w0+1GdctV6gpz/yNH7C6wSqlprYEhAVglVUCFf9w== X-Google-Smtp-Source: AGHT+IEKt3/v2ksI4nm6zT1RyP3q0/pl0UUeBwDtLns5GRb6k9jsZ1WvlVwUhB9nKPowQuiXiiRx X-Received: by 2002:a05:6512:31c2:b0:512:d5c7:60d9 with SMTP id j2-20020a05651231c200b00512d5c760d9mr2478058lfe.3.1708550626942; Wed, 21 Feb 2024 13:23:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708550626; cv=pass; d=google.com; s=arc-20160816; b=l5Slzgin2kTOdMhUkF/oTWd++DLS6ZZCtSqhHVyOfOtgA5558prii6fdV09BA5lS81 yl86P/O7aYFRmZAsVozrk0TPI6XnldrC1qEJg08vq/s5M1Rb0PKNxvBRsW6xgDOpqFxo p3zk6TgDjtm0H+vOyQml6MslAd6VyMN6qPLxAF4mnUgwVvJ80TWFLDygKaNqQ5gfNA27 LD94Jd9rFIfhtYSKnHGYAtK6rJQtNQ48m3EDSDOckFqT0gVY+ur2BMwKIgBC701/X1r8 xn+x7sTSVEMpku1ICRKi/gymUim8aDN2Db3yfkCwSf5bAQQJQLCqsmilCVu1aHXmV3tN LGQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=HZIfDFB+qHZTbDlUkJ5JuuXvN55Ime5SO9Jy3E23hCo=; fh=prODuj5w78c2tFfZKGLAvD3TYRpYO8SWzHKuIB4pSgQ=; b=PIo34zSIsbIIl2K5d1f6Vedwx+MCmiAp4ZOGuutD0UQGcV7a0ayd5HEGXjgBIlQ6pm mtX93p3BHSnHgk5lukS7k2liFPpcmnR52VnqFWYNrUIBG+/Oq91i/gFJFhsZMSpJVacC AYVUnhycNQaMCpwrndfmR7e9/PbPCae2C6IFfs2J8qaRmaXC74C31FW4d5H0xC4aRQUY ugoHJKKePr1fDRRlJirl4IwuhChN0i29M4Ryz50QtJ3V5990uAcxwCwpZ29lDjetlXhT WHJwbBIlkUqn+iWfgrrKCzbIM4t8IMs7ebxhOGuoe4l/xbCIbCZ7V+yaVlbHP1atbQly AD/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUbsc7jb; 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-75517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h25-20020a50cdd9000000b0056520a67649si270056edj.595.2024.02.21.13.23.46 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUbsc7jb; 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-75517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75517-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 889D31F245A5 for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 21:23:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13F0512880F; Wed, 21 Feb 2024 21:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LUbsc7jb" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 9118C86AE5 for <linux-kernel@vger.kernel.org>; Wed, 21 Feb 2024 21:23:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550590; cv=none; b=LU3Rz/Ws6xlO3dyp1EK3i65mhRRBuwtTuB1spRiEj0xEFFJ2XMVo1WSa31bW+MbbkOo6jOld8ioy1oJ4rVaEs9nYJuFQg+2Mcfp7pS8KhqIQw/wDhfXLzkQdurL1r96zi5OOUQEMLPFPDluNyb41Yv3F1kVSUaViasYVJHmPH0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708550590; c=relaxed/simple; bh=X1NMDwHNhaKtxaj2FzCnTNuRqpHnDCkiz42J4qyGhbU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FjdQg39HEAL1Y7JdrbGmhzIUWyoVyFYtiqBPXA6N7P0CGDNFtIYEh5aBpY8GK3rpUt+cQSA50Qnjh92aNNR9truGt2/g2w8ja7xd2/E4p+Gx3Iz/K/EQ6BmTbYiU2YbHTCc8GcCqrPEXf+3NTG/WqIKh7imugahHgcTUPqx31iA= 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=LUbsc7jb; arc=none smtp.client-ip=209.85.208.176 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-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d2531294faso18591691fa.2 for <linux-kernel@vger.kernel.org>; Wed, 21 Feb 2024 13:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708550587; x=1709155387; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HZIfDFB+qHZTbDlUkJ5JuuXvN55Ime5SO9Jy3E23hCo=; b=LUbsc7jbvQDwU/Bl92PpwY3ti3O5wypNeXzPVhtsIkkGuy4HWpcMZyAkdzv9rNCrhi wime29P+pOnRy2peg9VHdgK33jbHOvu/vib7L56yqAWyPn0ygt3IrtKKTi/uRLFRgcz3 c7UU8vQstjVZRj8JPaBjav7ZGvqTG+CeLKNrX1sR0QejFrBu6GP4W62UOL3a3wMQ/c/F OSpjrMv2sLWbad2/57tsMA5S7AJxcnCnqUxmlp5PQM6iWshh9CitAmLL0B4WytxHXvzj hMA/3WODy0lqx8uPpXtv8ZsJevlLimMoquqL0ZJXvJWF7sejVLJF+rQ72g6NPoE8Lccx VWJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708550587; x=1709155387; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HZIfDFB+qHZTbDlUkJ5JuuXvN55Ime5SO9Jy3E23hCo=; b=E+kOdMeAlu+YDCZlukH+Apeec6iRTofxG7Hk1tHCbc/Ju7/K3E7m34+cZgcrZFPaiI t3sTbhjYLjLF83Htp/uDBtYXIiU54hrtOOQeNk4gfalpcg+uCCybqBF2D0MuP3w2qLsT 2ELwh4f1Ul5HnCKtwoOM0LAH+EpC5KLXqU2Gv6Kk8TaSyrnQ6xsZDoA9qsIeTi9VvDyi 07DeoUoakPHZCMxYnp+qxgpU5a94htIUdr61PsESc8dN8GoVZO72nkoCiScTd3bXOm4M D2yfVaNwE98w8ANO/6SYHNMZbw3z2USElFBERfy5J0q1H24t8QkneNRjIQweFYl+vJyL lBEA== X-Forwarded-Encrypted: i=1; AJvYcCXsZlrvGxNsc4jYhnRwJ0U/gJCL/MNhRtVVU05Z72xDSH0td5P3KM/62F+IZ8Wlnh9FBq+Qp8b/YcYvq+cZCK5r160ivZQeSdK89QCS X-Gm-Message-State: AOJu0YxDZJxA6FDQ5i1Lcald9ztp249tk1no1A99RABESe5S+Av0VoLT IFY8v7sVxhXewDcXml42wbMmLvvqE0brFGe1lMlA8Ce0/c0xTuLktOoko2N95Hg= X-Received: by 2002:a2e:b8c8:0:b0:2d0:c77c:b1ca with SMTP id s8-20020a2eb8c8000000b002d0c77cb1camr14817121ljp.49.1708550586825; Wed, 21 Feb 2024 13:23:06 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h14-20020a056402094e00b005644221a3desm4018764edz.3.2024.02.21.13.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:23:06 -0800 (PST) From: Linus Walleij <linus.walleij@linaro.org> Date: Wed, 21 Feb 2024 22:23:00 +0100 Subject: [PATCH v2 1/2] mmc: sh_mmcif: sg_miter does not need to be atomic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240221-fix-sh-mmcif-v2-1-5e521eb25ae4@linaro.org> References: <20240221-fix-sh-mmcif-v2-0-5e521eb25ae4@linaro.org> In-Reply-To: <20240221-fix-sh-mmcif-v2-0-5e521eb25ae4@linaro.org> To: Geert Uytterhoeven <geert+renesas@glider.be>, Ulf Hansson <ulf.hansson@linaro.org> Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>, Geert Uytterhoeven <geert@linux-m68k.org> X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791545182417110471 X-GMAIL-MSGID: 1791545182417110471 |
Series |
Try to fix the sg_mitet bugs in SH MMCIF
|
|
Commit Message
Linus Walleij
Feb. 21, 2024, 9:23 p.m. UTC
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 <geert@linux-m68k.org> Fixes: 27b57277d9ba ("mmc: sh_mmcif: Use sg_miter for PIO") Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- 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(-)
Comments
Hi Linus, On Wed, Feb 21, 2024 at 10:23 PM Linus Walleij <linus.walleij@linaro.org> wrote: > 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 <geert@linux-m68k.org> > Fixes: 27b57277d9ba ("mmc: sh_mmcif: Use sg_miter for PIO") > Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > Hi Geert, it'd be great if you could test this! Done before (see the Tb above ;-) You probably still want to s/does not need to/must not/? (sorry, I miswrote that previously) Gr{oetje,eeting}s, Geert
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;