Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp252472lqh; Thu, 28 Mar 2024 00:17:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWF4o8Dyf4iFBjS7N8Rnl8Et+u0Z0FAZVCHEZyP/nrtgMDZCiuDYU9EYNe36TwanhWpdEehBv6ofZZBDmGXkvXz2zFS0yiS3nsVGgo6ng== X-Google-Smtp-Source: AGHT+IH0c2ep9J27G/zNe/TYegwlfLV600CCvMc2ey6flv+1GFdGczXNNlnFxX3Q01oNNX9+f4jt X-Received: by 2002:a05:6871:154:b0:21f:1705:d5b0 with SMTP id z20-20020a056871015400b0021f1705d5b0mr1981678oab.52.1711610257014; Thu, 28 Mar 2024 00:17:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711610256; cv=pass; d=google.com; s=arc-20160816; b=00H4fQInGV08U6zirW1NgpDr5pTLAuZs2ZV+vQTtmFP0hanldAy77XcDyrTCu+ANz0 cA01TtVB80w8oHxPDwsg7f7zUN4kX1GOrBzAxdBaUM2Ix+f0A0odYhSW2Rx3cl5LFotY c/GEjHqsUU1NyfV3cZS4kJf/IHOeV4Y8tnxyclc3NfS3yf3+ugsWnBOGjd1YWCm76AiP mKBEFcZ7apsctFZymJT4JXRzlZVXriJCEGD16mvQGBn1QNXX1MoURyUQs2Qmz/KCGVMA cKDyZk0c2Y7e0kcirh4HZ9QOuLlsMFsa3YBBaMgiDDCYT63VnQF4f/UEWKF+/2wBpGpf dLmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:date:subject :from:message-id:cc:to:feedback-id:dkim-signature; bh=PFSjeCNInVlPzMwtfABdaCtL50AVt6DS4rR8uU9qVFA=; fh=DNMVpX6AOzEySdL1gGHQ3Sh/3QGk1+cMlrAdfQFjHBM=; b=Ifmfdy1f9GMYwv35sNosWrkoOS3I8bY+l3pa+iq1cxKBPwPMGBb05X8FWcxdb6T4VW lSLbIX10HN07ADlpUe1RI6HiJfFAjclteZ7nUwxER/3jw1H7nb2k7Os2OJuEeW7fwsja JBN/NcD+snc31aU9i3JOpsGsQanE4ww8oW6kBCAPnlRK/X09cjeJH1vV+SjsyGNNanAK TnEeb0wJ5YN9vdSb/KmEEHhNa8vgZatBa1vX5ux0ep+6QfA79ey+DGpQDt3Vnog+/Yvi 6oEWptWn3L7bN49TtkpGIpjQIWrNLuYsAWoaAdAErhpWSabZxaxZxh9rPppyfRExirpU pbOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=dJV840id; arc=pass (i=1 dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-122395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122395-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s68-20020a632c47000000b005dc528d603bsi819776pgs.675.2024.03.28.00.17.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 00:17:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=dJV840id; arc=pass (i=1 dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-122395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122395-linux.lists.archive=gmail.com@vger.kernel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8C870B22CCB for ; Thu, 28 Mar 2024 04:13:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 988D339AEA; Thu, 28 Mar 2024 04:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dJV840id" Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 0742E38FA6; Thu, 28 Mar 2024 04:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711599211; cv=none; b=pPifKw+adZveME+DS8NIJrlEasfPzJVRk7FjvOppAta+wEFDME2zh1zpHC1aWXPap/q7+3T99ts+TSFRhK/nsAuXdxh3GQsHLYOFe5b2cnbJA03+NoGHajL8fkt9qmSnN7MCiwAJZX4tC4k7m6nXlIZw6zTXQuMsQF34bz2d/a0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711599211; c=relaxed/simple; bh=Aa/3y/xegCFZFZGfbAXJulQztjWalF3eRxbIfEpLqB4=; h=To:Cc:Message-Id:From:Subject:Date; b=GmAx58JI6Evw9LG+LA+z/WxrQDj3sNgoU6bPaQckla8HJgTMC0MBnIsdnJUo+keHwWde993zc0L88k791Jr3owvDPnznfI2QqnHUdTf3Y27psUj5gBfGAhsWiyriTGJBuRp06tfXDPcUiLLjq5jbfo7sRlzrsCReXXeiAx1IyAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=dJV840id; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 24D1011400C2; Thu, 28 Mar 2024 00:13:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 28 Mar 2024 00:13:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:reply-to:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1711599208; x=1711685608; bh=PFSjeCNInVlPz MwtfABdaCtL50AVt6DS4rR8uU9qVFA=; b=dJV840idAKbWgfPOKxQq5R3Ya2erO 632BFa50LyB+rF/oXEgSO5eeYRy3wpb2k7AV0ZPL8hUZvY17q0BBcXT+2HL7MTC5 fKr5bheHYLQOiTlmtDnRUg6e8oI8d3w5XgPjoVXgpQObuyCC8Poke7cYl8cWm3uA IxtylW9v7pUuSixm0jLn8I/sSZnYyLNGIF+HVC2qX3Rhu/t0/DlAW95oVlVilreL 8rJzq3DQympuEUuRaxYsGs4DeMQtMX6XTgSATwgomS3xju1JJi8H80nR0tokO3a4 ffoCR+F4BEuHdznGK0mXo/KgkfVss1FiYmT2Id/QQBdjVsns697Gx/8pA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddukedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepvfevkffhufffsedttdertddttddtnecuhfhrohhmpefhihhnnhcuvfhhrghi nhcuoehfthhhrghinheslhhinhhugidqmheikehkrdhorhhgqeenucggtffrrghtthgvrh hnpefftdekheelvddvtdetudelhfehhfejjeeuudeileettdeuleeigeefkeehvdevffen ucffohhmrghinhepghhithhhuhgsrdgtohhmpdhkvghrnhgvlhdrohhrghenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehfthhhrghinheslhhi nhhugidqmheikehkrdhorhhg X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Mar 2024 00:13:24 -0400 (EDT) To: Greg Kroah-Hartman , Jiri Slaby Cc: "Benjamin Herrenschmidt" , "Michael Ellerman" , "Nicholas Piggin" , "Christophe Leroy" , "Aneesh Kumar K.V" , "Naveen N. Rao" , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Message-Id: From: Finn Thain Subject: [PATCH] serial/pmac_zilog: Remove flawed mitigation for rx irq flood Date: Thu, 28 Mar 2024 15:11:33 +1100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The mitigation was intended to stop the irq completely. That might have been better than a hard lock-up but it turns out that you get a crash anyway if you're using pmac_zilog as a serial console. That's because the pr_err() call in pmz_receive_chars() results in pmz_console_write() attempting to lock a spinlock already locked in pmz_interrupt(). With CONFIG_DEBUG_SPINLOCK=y, this produces a fatal BUG splat like the one below. (The spinlock at 0x62e140 is the one in struct uart_port.) Even when it's not fatal, the serial port rx function ceases to work. Also, the iteration limit doesn't play nicely with QEMU. Please see bug report linked below. A web search for reports of the error message "pmz: rx irq flood" didn't produce anything. So I don't think this code is needed any more. Remove it. [ 14.560000] ttyPZ0: pmz: rx irq flood ! [ 14.560000] BUG: spinlock recursion on CPU#0, swapper/0 [ 14.560000] lock: 0x62e140, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 [ 14.560000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.8.0-mac-dbg-preempt-00004-g4143b7b9144a #1 [ 14.560000] Stack from 0059bcc4: [ 14.560000] 0059bcc4 0056316f 0056316f 00002700 004b6444 0059bce4 004ad8c6 0056316f [ 14.560000] 0059bd10 004a6546 00556759 0062e140 dead4ead 0059f892 00000000 00000000 [ 14.560000] 0062e140 0059bde8 005c03d0 0059bd24 0004daf6 0062e140 005567bf 0062e140 [ 14.560000] 0059bd34 004b64c2 0062e140 00000001 0059bd50 002e15ea 0062e140 00000001 [ 14.560000] 0059bde7 0059bde8 005c03d0 0059bdac 0005124e 005c03d0 005cdc00 0000002b [ 14.560000] 005a3caa 005a3caa 00000000 0059bde8 0004ff00 0059be8b 00038200 000529ba [ 14.560000] Call Trace: [<00002700>] ret_from_kernel_thread+0xc/0x14 [ 14.560000] [<004b6444>] _raw_spin_lock+0x0/0x28 [ 14.560000] [<004ad8c6>] dump_stack+0x10/0x16 [ 14.560000] [<004a6546>] spin_dump+0x6e/0x7c [ 14.560000] [<0004daf6>] do_raw_spin_lock+0x9c/0xa6 [ 14.560000] [<004b64c2>] _raw_spin_lock_irqsave+0x2a/0x34 [ 14.560000] [<002e15ea>] pmz_console_write+0x32/0x9a [ 14.560000] [<0005124e>] console_flush_all+0x112/0x3a2 [ 14.560000] [<0004ff00>] console_trylock+0x0/0x7a [ 14.560000] [<00038200>] parameq+0x48/0x6e [ 14.560000] [<000529ba>] __printk_safe_enter+0x0/0x36 [ 14.560000] [<0005113c>] console_flush_all+0x0/0x3a2 [ 14.560000] [<000542c4>] prb_read_valid+0x0/0x1a [ 14.560000] [<004b65a4>] _raw_spin_unlock+0x0/0x38 [ 14.560000] [<0005151e>] console_unlock+0x40/0xb8 [ 14.560000] [<00038200>] parameq+0x48/0x6e [ 14.560000] [<002c778c>] __tty_insert_flip_string_flags+0x0/0x14e [ 14.560000] [<00051798>] vprintk_emit+0x156/0x238 [ 14.560000] [<00051894>] vprintk_default+0x1a/0x1e [ 14.560000] [<000529a8>] vprintk+0x74/0x86 [ 14.560000] [<004a6596>] _printk+0x12/0x16 [ 14.560000] [<002e23be>] pmz_receive_chars+0x1cc/0x394 [ 14.560000] [<004b6444>] _raw_spin_lock+0x0/0x28 [ 14.560000] [<00038226>] parse_args+0x0/0x3a6 [ 14.560000] [<004b6466>] _raw_spin_lock+0x22/0x28 [ 14.560000] [<002e26b4>] pmz_interrupt+0x12e/0x1e0 [ 14.560000] [<00048680>] arch_cpu_idle_enter+0x0/0x8 [ 14.560000] [<00054ebc>] __handle_irq_event_percpu+0x24/0x106 [ 14.560000] [<004ae576>] default_idle_call+0x0/0x46 [ 14.560000] [<00055020>] handle_irq_event+0x30/0x90 [ 14.560000] [<00058320>] handle_simple_irq+0x5e/0xc0 [ 14.560000] [<00048688>] arch_cpu_idle_exit+0x0/0x8 [ 14.560000] [<00054800>] generic_handle_irq+0x3c/0x4a [ 14.560000] [<00002978>] do_IRQ+0x24/0x3a [ 14.560000] [<004ae508>] cpu_idle_poll.isra.0+0x0/0x6e [ 14.560000] [<00002874>] auto_irqhandler_fixup+0x4/0xc [ 14.560000] [<004ae508>] cpu_idle_poll.isra.0+0x0/0x6e [ 14.560000] [<004ae576>] default_idle_call+0x0/0x46 [ 14.560000] [<004ae598>] default_idle_call+0x22/0x46 [ 14.560000] [<00048710>] do_idle+0x6a/0xf0 [ 14.560000] [<000486a6>] do_idle+0x0/0xf0 [ 14.560000] [<000367d2>] find_task_by_pid_ns+0x0/0x2a [ 14.560000] [<0005d064>] __rcu_read_lock+0x0/0x12 [ 14.560000] [<00048a5a>] cpu_startup_entry+0x18/0x1c [ 14.560000] [<00063a06>] __rcu_read_unlock+0x0/0x26 [ 14.560000] [<004ae65a>] kernel_init+0x0/0xfa [ 14.560000] [<0049c5a8>] strcpy+0x0/0x1e [ 14.560000] [<004a6584>] _printk+0x0/0x16 [ 14.560000] [<0049c72a>] strlen+0x0/0x22 [ 14.560000] [<006452d4>] memblock_alloc_try_nid+0x0/0x82 [ 14.560000] [<0063939a>] arch_post_acpi_subsys_init+0x0/0x8 [ 14.560000] [<0063991e>] console_on_rootfs+0x0/0x60 [ 14.560000] [<00638410>] _sinittext+0x410/0xadc [ 14.560000] Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "Aneesh Kumar K.V" Cc: "Naveen N. Rao" Cc: linux-m68k@lists.linux-m68k.org Link: https://github.com/vivier/qemu-m68k/issues/44 Link: https://lore.kernel.org/all/1078874617.9746.36.camel@gaston/ Signed-off-by: Finn Thain --- drivers/tty/serial/pmac_zilog.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index c8bf08c19c64..77691fbbf779 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -210,7 +210,6 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap) { struct tty_port *port; unsigned char ch, r1, drop, flag; - int loops = 0; /* Sanity check, make sure the old bug is no longer happening */ if (uap->port.state == NULL) { @@ -291,24 +290,11 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap) if (r1 & Rx_OVR) tty_insert_flip_char(port, 0, TTY_OVERRUN); next_char: - /* We can get stuck in an infinite loop getting char 0 when the - * line is in a wrong HW state, we break that here. - * When that happens, I disable the receive side of the driver. - * Note that what I've been experiencing is a real irq loop where - * I'm getting flooded regardless of the actual port speed. - * Something strange is going on with the HW - */ - if ((++loops) > 1000) - goto flood; ch = read_zsreg(uap, R0); if (!(ch & Rx_CH_AV)) break; } - return true; - flood: - pmz_interrupt_control(uap, 0); - pmz_error("pmz: rx irq flood !\n"); return true; } -- 2.39.3