Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4922159imm; Tue, 19 Jun 2018 02:01:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJv0WGaLaq3ZTDeT0GW30GiX7myMpSUCOfZ6H+DxEc6wNmNOQzWoY0TTQZAPKdQPunOqL92 X-Received: by 2002:a17:902:b48f:: with SMTP id y15-v6mr17972703plr.261.1529398861723; Tue, 19 Jun 2018 02:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529398861; cv=none; d=google.com; s=arc-20160816; b=HG8Fr13xsj99hb5MQ6S2OM/CXcUc4gofwQOnETEy6xPIzbY2/WgLckF6h5Ubjntijd yzfILGX3ZbdSU9v39+XRMJW+5OlAT+OpN/q6BTtsMAdhx+NnTE9DJTXPC84fbYMA/DCo 2RihrJSsW4btscRrhV/cTp11Gpm+YNARFO+fut0sfEAWSEQzPI/T5jEdQSIDgj84saoi qtSjLUTIkjA82t/ztPzg8FluaIUldXB0AKRHYauWWnLP9ZudrWtvxiqN4VHzJcqXwG4Y /ZlxtqPxtWQmKpt57Rq2xHsVaseg8wVUN/gvqC+KAcA9rPL9U6/5buQBLqG6CpcNBjJa p80w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=qdze1EzkHiIKBaifwDVXCIhkI/2AXUDypdrUSi/bdf4=; b=Rqq0oORHEu3l+5h2Ap9/qF6FMQubRF6Pv/4ew0Ymk3c7pGmEdZfZWMOT3Q9xPXVE7K jlej86g5BvCQdl7vzf3QVNh0DqfEd09532m7A2pieM3N2ZhsJxrzbYhVniIHE55xGcaS NRtE5u6UPEwUvLQUGrPYL91daxetE7BYaADi6WB0h/OKBPcIckJ7gaoRz+xFhRYXcSm9 HUeMpt3dnLDL0g+25EEBMJm9KTYrmkrHtzJB4KM59gbd/pVFra2Gydvh40o63wAfD+8l w5xDq/bAjkr1TIm33a+aK+CAexrBVDYL8N9Aa/5NJDU3fEIFjJ1Ii+GOSlPwVZRRG+IE SLPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GmcsiKAO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w25-v6si13589301pgc.628.2018.06.19.02.00.48; Tue, 19 Jun 2018 02:01:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GmcsiKAO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965828AbeFSI7n (ORCPT + 99 others); Tue, 19 Jun 2018 04:59:43 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:40677 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965732AbeFSI7i (ORCPT ); Tue, 19 Jun 2018 04:59:38 -0400 Received: by mail-pl0-f68.google.com with SMTP id t12-v6so10587455plo.7; Tue, 19 Jun 2018 01:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qdze1EzkHiIKBaifwDVXCIhkI/2AXUDypdrUSi/bdf4=; b=GmcsiKAOdQbEMM7tClX/O0wSEHFwtLmOGyQRfLky4cCp4nBBkewC93kmZ1eh0FRYdZ jEXM76MMmPFrnVNWxbMgIySLjpjmtz/fMnYW59DCQ3qaQCx2vlHQF1vZG9lkYk/vo0w2 nOvG8Fhx96DOtpunax4oiGwN3wpEpdkk5p0Ik+lA5VB3Qkobj4qcTdr3hIlA3sRVzz5j tiJmchiJsbYJqoagtwijZDB67HZcBJuUICVuAlTxVe/KViTY3/02ezx9JjfmB/hEc06z atK3kiOT+pHEtZqr2434r7rulMrHp+yRe9wMwwB5YubNzEtNz183XnZjMTD1jJ9IDGzi i1oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qdze1EzkHiIKBaifwDVXCIhkI/2AXUDypdrUSi/bdf4=; b=dSi/HpdZv3Byrc9hjzQxjjkcP+sVCUBttTrJi90YjIJHPuaYUYAxXaIEHRncK6ukuS 5oMs7M19VjSlWEw81/vPZ1QJBK+B6D2XKv/r1Z5Hv8JYrNGvrYW6DY1OtXYAlNZ0jl7h J2wKZqjteMX7Qar2VgGvd3h3q7RAcBz/E9z3A1nT5zXK8KUzYpwTPt+nn4yHiCgCuGrS dPRVTQUXTWTXEFGiXQBoelwjfmfMMYAm7ZN6np/Y1U06hMSH6cSZJuvZCalv+PKbg9Cx CZYzNXOQ2wxNMBFK146vq/PjQrhy3HKDfT+VJ3qNQ+BTARc4en+ZYmj77PjDdZ8evnDd 5bbw== X-Gm-Message-State: APt69E1WRpw35aGGbruHxjeW95WXx7cO71+2zhv5eQ5vBZJzAqqv6GMa cDeqUqwLOs5G68RVyfUk9vAmaiPC X-Received: by 2002:a17:902:9b92:: with SMTP id y18-v6mr17569942plp.57.1529398778390; Tue, 19 Jun 2018 01:59:38 -0700 (PDT) Received: from localhost ([175.223.26.106]) by smtp.gmail.com with ESMTPSA id z19-v6sm20076991pgv.12.2018.06.19.01.59.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jun 2018 01:59:37 -0700 (PDT) Date: Tue, 19 Jun 2018 17:59:33 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Alan Cox , Steven Rostedt , Greg Kroah-Hartman , Jiri Slaby , Linus Torvalds , Peter Zijlstra , Andrew Morton , Dmitry Vyukov , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC][PATCH 0/6] Use printk_safe context for TTY and UART port locks Message-ID: <20180619085933.GA2631@jagdpanzerIV> References: <20180615093919.559-1-sergey.senozhatsky@gmail.com> <20180618143818.50b2f2f9@alans-desktop> <20180619005308.GA405@jagdpanzerIV> <20180619083021.4avsgvcqjrpkat6s@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180619083021.4avsgvcqjrpkat6s@pathway.suse.cz> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (06/19/18 10:30), Petr Mladek wrote: > It is re-entrant via printk(). I mean that any printk() called inside > the locked sections might cause recursion if the same lock is needed > also by con->write() callbacks. Perhaps Alan meant that we cannot return back to tty once we passed the control from tty to printk -> uart serial console. So tty is probably (but I didn't check) not re-entrant, but uart definitely is re-entrant: IRQ -> uart console -> tty -> printk -> uart console. The patch set attempts to address several issues, and re-entrant uart is just one of them. [..] > This patchset forces safe context around TTY and UART locks. Right. > In fact, the deferred context would be enough to prevent > all the mentioned deadlocks. Agree. But we can leave it as a printk_safe implementation detail and change it later, outside of this patch, to avoid further confusion. > IMHO, the only question is if people might get familiar with > yet another spin_lock API. Right. That's why I thought about renaming uart_port and tty_port ->lock to ->____lock. So the naming will suggest [hopefully] that those locks are not meant to be used directly [anymore] and instead people should use uart_port_lock/tty_port_lock API. -ss