Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp327748ybg; Wed, 3 Jun 2020 01:43:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLlVU8WH0vG41erSuWO1Pqbu5dFZN4TNvdT+7HVbO/rm4rjhDMN4T0rtvPEGZhBBxKpn1x X-Received: by 2002:a50:9fc2:: with SMTP id c60mr10057330edf.319.1591173799163; Wed, 03 Jun 2020 01:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591173799; cv=none; d=google.com; s=arc-20160816; b=dXre3B3ZKvb34XzPTegKrzvrtLiADq85/I2+GCpMTi9XMaCkdO1bubJB/dluFLFEKi msVhRkKBTHdMVmYuFZuKSZYWiqMV493uh2bba1t4Ub2jT6c0vubVAFCBFBdTJLAHXmt+ GCoP2HF83Kd3Rsic7xp4eIu682u9extSVOz8qStAp+NFhlgYD3kxt91IT/WQloiQeDiZ A+6t/wbgrW+Ft4dyQ5eG4Rzwx9b1XBrf4LN99KU/G4O7KwBAtfAKJIBxahstnrMTPMLM Oy5dlFwHb+5BthFZ1rnzBarEqoRWU9z6aA7/qCDw0B/Xh+e3C+qrZSRlk+iZSwuIG1YU 0CPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Y3+NZ002fR5cwFINbc/o3dpUhIJL9xPazQ2yRYvAcPI=; b=MPY+wY3Nosoyup2rbXMiVyii0rxpPAc+32yJbKWoe8KTYpBfi35uBR9jj0qMP2v9Lc 0u1x532ev1jgGvBQml3A2U1gRTZFj8bfo5C6OuJ2X7OfJs4gQpPfx8iZimVATJ41d3kw uqQdPe7sUL6fjzw7hJ+h8v6B8cOC+uEDKMYktJMcPENs+axEGaHi+6CjW6mH9u37YWfq palf2s4jxpYfe0WVnZsCeh2nZFzAWsC2m9XlCJEhzBGcaz+79FLvmlVlkBjMeGWr9JHu EGV+k28eai5KtLruSFrAHscrj8P3EZttJOy/2WNvcu7IEKZmv+mz+XN0pFyvcVh2UEzA eo3g== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be4si730696edb.610.2020.06.03.01.42.56; Wed, 03 Jun 2020 01:43:19 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726099AbgFCIlF (ORCPT + 99 others); Wed, 3 Jun 2020 04:41:05 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38363 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgFCIlF (ORCPT ); Wed, 3 Jun 2020 04:41:05 -0400 Received: by mail-lf1-f66.google.com with SMTP id 202so789914lfe.5; Wed, 03 Jun 2020 01:41:02 -0700 (PDT) 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; bh=Y3+NZ002fR5cwFINbc/o3dpUhIJL9xPazQ2yRYvAcPI=; b=hCKGaV93HEyfanQW2nAnEjNxbwDsgSYdkTODol6+PNwAyo+kuNPDUKiMhE80mpiu9o zubbOA8qpI5QX647m0BK2AAWL2lLBQm7rYvJmni8wTFJcbW/j6/1sAT4blQrmczyWa21 PkFK/71ER6yi7IGo/HTGm+WmsJ9hVxb2jo4JUWEfKWbEmTqsb1ydZB/F5t96HyhSFqER QoFFj2ZwrQbFgNU3p4BAFtONiYu36xAAAerV4jGEKj6ZMWvp209JFnOkw368Of8RLXku WIXRMe7s/7BCS8M+TwOQUYOerldFaRTirFNp8LhCOdFqd2+oO6al5lxUaKw6hRKBvqH6 4jhw== X-Gm-Message-State: AOAM532MKL7xWBuCjQZLzHVIGx2++6Fs35TJgQGSNcVTihnQuXFP0jbB aJ2N+y6DsKs3nMgmICIQOfI= X-Received: by 2002:a19:434e:: with SMTP id m14mr1905473lfj.40.1591173662210; Wed, 03 Jun 2020 01:41:02 -0700 (PDT) Received: from xi.terra (c-beaee455.07-184-6d6c6d4.bbcust.telenor.se. [85.228.174.190]) by smtp.gmail.com with ESMTPSA id w20sm298508lji.7.2020.06.03.01.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 01:41:01 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.93.0.4) (envelope-from ) id 1jgOx9-0002Ai-OO; Wed, 03 Jun 2020 10:40:51 +0200 Date: Wed, 3 Jun 2020 10:40:51 +0200 From: Johan Hovold To: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Andy Shevchenko , Johan Hovold , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List , stable Subject: Re: [PATCH 2/4] serial: core: fix broken sysrq port unlock Message-ID: <20200603084051.GJ19480@localhost> References: <20200602140058.3656-1-johan@kernel.org> <20200602140058.3656-3-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 02, 2020 at 04:34:16PM +0100, Dmitry Safonov wrote: > On 6/2/20 3:48 PM, Andy Shevchenko wrote: > > On Tue, Jun 2, 2020 at 5:03 PM Johan Hovold wrote: > >> > >> Commit d6e1935819db ("serial: core: Allow processing sysrq at port > >> unlock time") worked around a circular locking dependency by adding > >> helpers used to defer sysrq processing to when the port lock was > >> released. > >> > >> A later commit unfortunately converted these inline helpers to exported > >> functions despite the fact that the unlock helper was restoring irq > >> flags, something which needs to be done in the same function that saved > >> them (e.g. on SPARC). > > > > I'm not familiar with sparc, can you elaborate a bit what is ABI / > > architecture lock implementation background? > > I remember that was a limitation a while ago to save/restore flags from > the same function. Though, I vaguely remember the reason. > I don't see this limitation in Documentation/* It's described in both LDD3 and LKD, which is possibly where I first picked it up too (admittedly a long time ago). > Google suggests that it's related to storage location: > https://stackoverflow.com/a/34279032 No, that was never the issue. SPARC includes the current register window in those flags, which at least had to be restored in the same stack frame. > Looking into arch/sparc I also can't catch if it's still a limitation. Yeah, looking closer at the current implementation it seems this is no longer an issue on SPARC. > Also, looking around, xa_unlock_irqrestore() is called not from the same > function. Maybe this issue is in history? xa_unlock_irqrestore() is just a macro for spin_unlock_irqsave() it seems, so not a counter example. > Also, some comments would be nice near functions in the header. Agreed. Let me respin this and either merge this with the next patch or at least amend the commit message. Johan