Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp326728pxa; Wed, 19 Aug 2020 02:22:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvBSfKMwzPb1rC3mbLgL2VxFbXEnCTchOq5KQEq0fKpF//wY2ixn2C5G4QUXluk3ZAqGhd X-Received: by 2002:a17:906:b59:: with SMTP id v25mr24030325ejg.436.1597828940171; Wed, 19 Aug 2020 02:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597828940; cv=none; d=google.com; s=arc-20160816; b=JhpmN2Q5Oh1D1GstfsKAGuGVNWJm7LFTHy+s2FVYBQGAHUwRjIVTFxMB3MTDaMU3hz 4AdhI/vUzZf/THe9z4k6YffMDaf60ej411/JLEHVGX3KxRj4+SbO+dG5gSno7OigHxTm quZi1LsPmsHKUxjWdpmO0anP7J1iPhjceWytOEo/M5y+vcfePwhzLf+Tfol7WRGp4O4+ ujFJvDWOHCD1iHzrChA+ZinWYr96fqyGPbj+Y6kd/IucNsrt143iJ9hF+N6X20KSY+Z9 iIZ8k2B6Od+ldpmkbJo7zg6AdQW/y7bHCvKXPSemO/sG6DlONZbZqCVu2Ib0jFcKt+PB HctA== 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; bh=TyCu9VIzwql84rK/AX1f5w+CQu4EFsTWYzHj1yjjPEY=; b=ZCMQUOv8bGFAlgpEdrS7iIdIGiFUGPewTLmNEl40ILBMosAOTm2KDbPfrHNvW/axuD MefkpMJXuEevavbgNZ0nEJsTuMUjyGbdwGNK1M+vE3ccNt/GJeWbxiSFAhloF43DtvyX 0CwYcbzrymcFP7KutlSW10ENu0Im8CdYUPKza2DWRd8ye5EPYKVprxmWTTLKYTXAfD49 oOnAZa9TH8Q7e7XPrvC110+0yyV5MJSP3i9Lb2rLnyylfc7JQb8hRrXJ9bKxIB75UD5z S9LhTsVv0IeXGzArR9HVO0RDQEhP0mpLJKUBxpp1giNRYnwtEJKQNKS7ydfZs5FPSc9v pFHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si14908854edq.23.2020.08.19.02.21.55; Wed, 19 Aug 2020 02:22:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbgHSJVP (ORCPT + 99 others); Wed, 19 Aug 2020 05:21:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:42968 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbgHSJVI (ORCPT ); Wed, 19 Aug 2020 05:21:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7302CADC1; Wed, 19 Aug 2020 09:21:33 +0000 (UTC) Date: Wed, 19 Aug 2020 11:21:06 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Greg KH , Andy Shevchenko , Guenter Roeck , Tony Lindgren , Kurt Kanzenbach , Raul Rangel , Steven Rostedt , John Ogness , linux-kernel , linux-serial@vger.kernel.org Subject: Re: [PATCHv2] serial: 8250: change lock order in serial8250_do_startup() Message-ID: <20200819092106.GA4353@alley> References: <20200817022646.1484638-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817022646.1484638-1-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2020-08-17 11:26:46, Sergey Senozhatsky wrote: > We have a number of "uart.port->desc.lock vs desc.lock->uart.port" > lockdep reports coming from 8250 driver; this causes a bit of trouble > to people, so let's fix it. > > The problem is reverse lock order in two different call paths: > > chain #1: > > serial8250_do_startup() > spin_lock_irqsave(&port->lock); > disable_irq_nosync(port->irq); > raw_spin_lock_irqsave(&desc->lock) > > chain #2: > > __report_bad_irq() > raw_spin_lock_irqsave(&desc->lock) > for_each_action_of_desc() > printk() > spin_lock_irqsave(&port->lock); > > Fix this by changing the order of locks in serial8250_do_startup(): > do disable_irq_nosync() first, which grabs desc->lock, and grab > uart->port after that, so that chain #1 and chain #2 have same lock > order. > > > Signed-off-by: Sergey Senozhatsky The patch is committed in printk/linux.git, branch for-5.10. Best Regards, Petr