Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp192403imm; Tue, 19 Jun 2018 19:03:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKISMB/eqtTYV3OHlbq7ggOt8yFQsYZ7YSOKBzF4+GwAZK//uda2fU+m30Iq2H85wwOeZiPV X-Received: by 2002:a17:902:8e87:: with SMTP id bg7-v6mr21349874plb.129.1529460183625; Tue, 19 Jun 2018 19:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529460183; cv=none; d=google.com; s=arc-20160816; b=KAT/4xv+jkH7J36qeBk+UqBMu66ISWUiyjupJqw4BfjTor3Sv2vy7Hz+8fUVKT2rrf ol1HOCAou3LjkkxBEspVR0xciZ4XcdOY0sDi1ljfx2u0jhdSmBwxPQYVlfnEYfq36DYN KS50c0Oe58K74W1d1lRRjoLRJ2/rgjWvMn8M6ArP5GAeISJVh05yZpYiZVKHYegHDjtZ xEmd6LTQYAeQGq8xKbFOb/zbx1ktlD8+UNzZInjiK6ouTy9lKATpgYtG4ms9Yx5z93m3 BQbmt7WnwXZJ88dNV1GWOXYBaBiuH9BFM80BHX81ISgU/IbRvCOYdcoNBRpDy21yznsY +37A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=sUuWX4Cv/N/G0IlDB22wAs/eO61RaRo2Hh0SiVvV/Lk=; b=eGk5JfFtdpWHpz7QTsMyVeWo/onzj5Fz3lcYveVMoqObB91Un/DmtaKlid2A2qT7wl NjcrK90MbZSirY3owL5K2SlPW0U5EF/9XnBbeyEtYrSMfkM7jDt/LGU59uh1g4Xx16de rsQn2P2SAOVX1JomwcwVo7nRC0177d9GaHJ9gq8hGA6/QZ5MOsial06U8jKn34RBblXa 6grBduNUikzBsG3iCxfhLMOGCA8CykiyDjusamFJId1qeRH1zjghtyVWX9QZnrxsiIW5 uhmiDVKADXuikJJx/BfSndUz8HnAOBxqY8JVxd9w/xoz0chz8PK8TkePb/fBn1/KE5e3 o+iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=WsNKLR8W; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o15-v6si918996pgv.580.2018.06.19.19.02.49; Tue, 19 Jun 2018 19:03:03 -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=@linux-foundation.org header.s=google header.b=WsNKLR8W; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbeFTCCF (ORCPT + 99 others); Tue, 19 Jun 2018 22:02:05 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:43575 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752784AbeFTCCB (ORCPT ); Tue, 19 Jun 2018 22:02:01 -0400 Received: by mail-io0-f195.google.com with SMTP id t6-v6so2034322iob.10; Tue, 19 Jun 2018 19:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sUuWX4Cv/N/G0IlDB22wAs/eO61RaRo2Hh0SiVvV/Lk=; b=WsNKLR8WLJtsv/Zau3ADa9TMWxTYuDc+Q5A1Fgz9RlvS8mYt3bLYCGDEIUpgO39dwZ qC5I3C9EuhqdNlqBJj49QSfWr4wVvo4uQX/ZM3gFXNXAg8/HmEXx4WuVS/Mg6btgmraO Qa5G9jqOu3I51CieQPcEtGlMCdaXUO+J8dlJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sUuWX4Cv/N/G0IlDB22wAs/eO61RaRo2Hh0SiVvV/Lk=; b=W4fuV+ki2PBbjftu3evFXHOAvgTDN5lakCZWdAk6FEv/TWp+XTij8tnsFfOcnJdZxb cuCgZyUiCFqM7LlZYT0b29u6HiIrKAxQYdzdkHKDnZ50IhE/7nCzjM16/ZKGEV6tSYQL CGmvnN2fyPZTbsKgyqwQhdoiPpZKXZ8jje1WGr0h5pDeok3FCkXJ0EbQZEDvUReg+82I zcMp0Of562VS5SstwwqdF5qGXvAnSs/z4oAZKFIbaLhDV3UKAGLtTsYM7Gbm/wyeVwbr pdKkktnzd5iEO6h0/pXWG+ZeVFZ6ab44ICw5L3TtEnhi49e62BEpf2TXfkyGgqjS/Vey zK4g== X-Gm-Message-State: APt69E3eyy83HMNSQ4RgLyQLowwwmpwyg57CiCaAgJb2E+SdVryZCoUp aBwDWkNcFIoD4B+6A+TDs4c4pQjmZsxXaV28yw8= X-Received: by 2002:a6b:1502:: with SMTP id 2-v6mr16465892iov.203.1529460120427; Tue, 19 Jun 2018 19:02:00 -0700 (PDT) MIME-Version: 1.0 References: <20180615093919.559-1-sergey.senozhatsky@gmail.com> <20180618143818.50b2f2f9@alans-desktop> <20180619005308.GA405@jagdpanzerIV> <20180619083021.4avsgvcqjrpkat6s@pathway.suse.cz> In-Reply-To: <20180619083021.4avsgvcqjrpkat6s@pathway.suse.cz> From: Linus Torvalds Date: Wed, 20 Jun 2018 11:01:49 +0900 Message-ID: Subject: Re: [RFC][PATCH 0/6] Use printk_safe context for TTY and UART port locks To: Petr Mladek Cc: Sergey Senozhatsky , One Thousand Gnomes , Steven Rostedt , Greg Kroah-Hartman , Jiri Slaby , Peter Zijlstra , Andrew Morton , Dmitry Vyukov , Linux Kernel Mailing List , linux-serial , SergeySenozhatsky Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 19, 2018 at 5:30 PM Petr Mladek wrote: > > To make it clear. This patch set adds yet another spin_lock API. > It behaves exactly as spin_lock_irqsafe()/spin_unlock_irqrestore() > but in addition it sets printk_context. > > This patchset forces safe context around TTY and UART locks. > In fact, the deferred context would be enough to prevent > all the mentioned deadlocks. Please stop this garbage. The rule is simple: DO NOT DO THAT THEN. Don't make recursive locks. Don't make random complexity. Just stop doing the thing that hurts. There is no valid reason why an UART driver should do a printk() of any sort inside the critical region where the console is locked. Just remove those printk's, don't add new crazy locking. If you had a spinlock that deadlocked because it was inside an already spinlocked region, you'd say "that's buggy". This is the exact same issue. We don't work around buggy garbage. We fix the bug - by removing the problematic printk. Linus