Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp401805rdb; Wed, 17 Jan 2024 05:42:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgn1oENJR3uttICUeKIH12iH5vfIZQha1tN9D24SoHo4JWvLk5TWZt0XV3QNo0KscrtRal X-Received: by 2002:a17:903:22d0:b0:1d4:fd75:65b2 with SMTP id y16-20020a17090322d000b001d4fd7565b2mr1473981plg.30.1705498968069; Wed, 17 Jan 2024 05:42:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705498968; cv=pass; d=google.com; s=arc-20160816; b=IxK3riOQqWJ3nkTh8jKZaowJa46Res039jaaOyxADXPtEgJSTszHItEwLnp7KVkOmn G5qiFrQYx4SrlW/k1VYJ656OLKbucbhUej/yA0HLyLs1l3C3s5T1j7rCatnZoCvmeEwf g6J87ru3kv6ZJMrJe6iufOEjk5Ls7Vtj7sSwJ4HADQWNfgQdV6f0d47vCIWn5R96kvD0 ckF9w8YB4V2+Yu8bnFRHo8kaionaE79dggWFKHLRDV3oFd0XkKIN28XpzCCOcVmJzlJS KuOE1VYKvk91r5XxuBP+7lmjfiT/v4v13xTrdhii9T2rKTt8PEQhvFMj4goNBBriAhO8 Bzbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=4ZC+51fURMNsrZMs60syMJyw2GHfrcZPYF5r36IEGtU=; fh=rpRGZ56lqcN346TVrMREnBfCmbftwU5D1tuVRt4k4Yk=; b=Y0Bsp6RRqm7ysPyDZP4AiYxAuvCyvIEB2Bxj11k5ma5X81lkoueh74s4ItlSQzKU2S MzP1UNR3TVXAUM6AuGW0j8Rw/8LC2VsUtdIKikJhH1FzPeY/Y+4jqeg0wU6OupGYqCLT WjEZRVvcKDycTMQXV4jJ2Zz9DktWcMZ8XKdh7uoE1ztaSuwCM5BgG5mANmfdzVfoCw7s AKcfmv9fWC92ImZzxKAxMXkrr6vhhWLVoqejWt0KeAsDg5WwPSDnXSGfw0dGG0jylfGU Lq/eg5l1ZCr9aETeKy8AwDW9EUY38asHoqT2j6q+1KqS/Egx5xJJty5mk1LdTWpPAHQV 97xA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="gj/UOBnl"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Re46DMnb; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-29031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id mg12-20020a170903348c00b001d6ec26ea80si1759112plb.442.2024.01.17.05.42.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 05:42:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29031-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=@linutronix.de header.s=2020 header.b="gj/UOBnl"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Re46DMnb; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-29031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 897D7B23E0B for ; Wed, 17 Jan 2024 13:42:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8F5B200D9; Wed, 17 Jan 2024 13:42:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gj/UOBnl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Re46DMnb" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 86D261EB57; Wed, 17 Jan 2024 13:42:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705498956; cv=none; b=GPzlaz/iYWq7Ug5BsaISMmLbxdEYnlYDVRAvpiSyWgbLux9uktN1meGgI2slgLtXfP+Izpc52AU1NzNDqS5+cDFjhnZb7qkVC61SvOrcWVaOlVFuVAXB/ORR2eEO5ZL55QWcaNXmvApQU7bPCuLfysdG+znBRELnqQY6fU+vo84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705498956; c=relaxed/simple; bh=dyRNCFjn8d4+GiBuo7xutiy2wG0X8ur1DJVGIRCZJ3c=; h=From:DKIM-Signature:DKIM-Signature:To:Cc:Subject:In-Reply-To: References:Date:Message-ID:MIME-Version:Content-Type; b=paSIcQI5NBi8groEzCk/hwwfIM/abyaavqQjMfmUDPRNciamPnziOk1I+X1KX6iBkt0CZ+HPixIGziaG+yEOs0pl0+4pv5KuoRa5QUOMQpUVZxDyD477pq5LdaDdSPyzHUpZ1MGKm0BJ0JyURMiGdg+S5RcgG8NItiBJQSujw+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gj/UOBnl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Re46DMnb; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705498952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4ZC+51fURMNsrZMs60syMJyw2GHfrcZPYF5r36IEGtU=; b=gj/UOBnl59bxLYbK/mOcWgN3nHx2wu65J9WrhSK4j3mEz8VfdDi1sW8nt4eyYGKlLU2q1c iK1QXiPzdJoZp9aNAAIlR5pSymLFc9bnvEWOoeawh224ZkyO5E3m73FxVj9hmcfSy8muAE C5VcxRuOIFJoaY9rvwM689VwI38MZJ0pNp2dpq+VQOD39ocFITK1ncrBklkO2anS6Q1QKL 8cCWSmMsmIYarXkWBTW3z5qAyNLh4ww5nVuNsNlCIOPccVkj+vPqYYsUziDbIPA85EdHBl XThd5sRsLJlSxNe5lXwNqCKwUfUBLQaBYTykE0Pw+xGq9wa/uklxkw+bkXRBOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705498952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4ZC+51fURMNsrZMs60syMJyw2GHfrcZPYF5r36IEGtU=; b=Re46DMnbHsx4PlSNwrmlTmf1m/xT045rSGqgiL1DVcJvUkT36SXyNPtAV9UWnlPwTmNFwG 8PYUvCxtrtmD4nBA== To: "Chang, Junxiao" , Sebastian Andrzej Siewior Cc: "tglx@linutronix.de" , "rostedt@goodmis.org" , "linux-kernel@vger.kernel.org" , "Li, Hao3" , "Li, Lili" , "Gao, Jianfeng" , "linux-rt-users@vger.kernel.org" Subject: RE: [PATCH] printk: nbcon: check uart port is nbcon or not in nbcon_release In-Reply-To: References: <20240117065226.4166127-1-junxiao.chang@intel.com> <871qagtlk2.fsf@jogness.linutronix.de> <87y1cos2dv.fsf@jogness.linutronix.de> <20240117102446.itexUYMc@linutronix.de> Date: Wed, 17 Jan 2024 14:48:28 +0106 Message-ID: <87r0igrs8r.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On 2024-01-17, "Chang, Junxiao" wrote: > As you mentioned, same console driver is only registered once. 8250 > console driver is registered once, its "struct console *newcon" > parameter is address of "univ8250_console" which is defined in > drivers\tty\serial\8250\8250_core.c. > > However, in each serial port device is registered, their cons pointer( > "struct console *cons;" in "struct uart_port") will be assigned with > same cons in API serial_core_add_one_port: > > uport->cons = drv->cons; > > That is, multiple similar 8250 uart_port devices have same console > pointer which points to above univ8250_console. Ah. This explains the "(port)->cons->index == (port)->line" check in uart_console(). Thank you for clarifying. > BTW, this issue couldn't be reproduced with v6.6.7-rt17 kernel. The reason for the change is because console registration/unregistration is not related to the port lock. There is a potential race condition if nbcon unlocking is based on the UART port still being registered as a console. We could move the @locked_port flag to the struct uart_port. (Probably renaming it to @nbcon_locked_port.) I think that would be the appropriate fix. John