Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3170616yba; Mon, 6 May 2019 18:45:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7dt/oYaNZNfuib+Ca2wvVYXBwpMBiRZOIiphFNnAhmk9hKy/+ncFdZZvL1znfcc8w2hg0 X-Received: by 2002:a62:544:: with SMTP id 65mr37427208pff.46.1557193522043; Mon, 06 May 2019 18:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557193522; cv=none; d=google.com; s=arc-20160816; b=EaOFFM9w/7z7KOcEOR235rrY37O2C9CAggkTgv+b7nQTWM5QgTISfujebXTXtqPJ34 5bDw+jjmjzvqWFKWn6br9cjJAXCsOAg6tmMJtNx717QfWhoctY5tCx7vftprQr0uT4v5 hGB756O0Gr6cRvaki1Rik6nP4Ho+dhi104ue9Sa/JZB+RsvywXJNqsQeqzWF8dsqV0/1 0jW+dWrM55XjKTFGG96QD/XlbQf3YDwpEQ4b/pbvE9hqZaXT+p0RgcH7baSxx65dbbyK bOZEWDTrmyvGxWOjdTMQnN4EDDfctO4MRqF5e4SoW5lmXKq1gkC4kaTsHTPyUlZj0bJa /mWg== 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=FyTJYhjrlBwUwWbi6VDFmjtluqIcl17wIaezUqQq5Dk=; b=WZQ+1NgmZtmtjx6QBnwFPaoUWyp1W3gaSbWFDOXjnt0TG8TPhHgmoJ1FIRNiRZvaHn s/Afg0L39i7DQdkyJVvLGcPrHi0yPWW9y+zyqKC9fkM1zzU9TSEfclyAGYpfWbd3c840 pNQJzS3cbPJL0HjS3VUPwhUM8PM0GRw/qiO90KaUZwIYFQqNXzFAMIhcCMPzjRGbGxVI XlxKiFgFyKa03rcbI4wlOjllfRZutEqPhdUfjLcKcKycOzp9NSgUyZzzuJUHBdpG9Ne2 o4VVwWmYfrGQA1twKZsvSg7ki2iR/wvJIaU64p6GPfN+ovIAEljjT7NbB4YcrRnwJ8mS hZ/g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e126si16676593pgc.211.2019.05.06.18.45.06; Mon, 06 May 2019 18:45:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726416AbfEGBni (ORCPT + 99 others); Mon, 6 May 2019 21:43:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50114 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfEGBni (ORCPT ); Mon, 6 May 2019 21:43:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCC4F308427D; Tue, 7 May 2019 01:43:37 +0000 (UTC) Received: from treble (ovpn-123-166.rdu2.redhat.com [10.10.123.166]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CC131001925; Tue, 7 May 2019 01:43:34 +0000 (UTC) Date: Mon, 6 May 2019 20:43:32 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Joe Lawrence , Kamalesh Babulal , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] livepatch: Remove duplicate warning about missing reliable stacktrace support Message-ID: <20190507014332.l5pmvjyfropaiui2@treble> References: <20190430091049.30413-1-pmladek@suse.com> <20190430091049.30413-2-pmladek@suse.com> <20190507004032.2fgddlsycyypqdsn@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190507004032.2fgddlsycyypqdsn@treble> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 07 May 2019 01:43:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 06, 2019 at 07:40:32PM -0500, Josh Poimboeuf wrote: > On Tue, Apr 30, 2019 at 11:10:48AM +0200, Petr Mladek wrote: > > WARN_ON_ONCE() could not be called safely under rq lock because > > of console deadlock issues. Fortunately, there is another check > > for the reliable stacktrace support in klp_enable_patch(). > > > > Signed-off-by: Petr Mladek > > --- > > kernel/livepatch/transition.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c > > index 9c89ae8b337a..8e0274075e75 100644 > > --- a/kernel/livepatch/transition.c > > +++ b/kernel/livepatch/transition.c > > @@ -263,8 +263,15 @@ static int klp_check_stack(struct task_struct *task, char *err_buf) > > trace.nr_entries = 0; > > trace.max_entries = MAX_STACK_ENTRIES; > > trace.entries = entries; > > + > > ret = save_stack_trace_tsk_reliable(task, &trace); > > - WARN_ON_ONCE(ret == -ENOSYS); > > + /* > > + * pr_warn() under task rq lock might cause a deadlock. > > + * Fortunately, missing reliable stacktrace support has > > + * already been handled when the livepatch was enabled. > > + */ > > + if (ret == -ENOSYS) > > + return ret; > > I find the comment to be a bit wordy and confusing (and vague). > > Also this check is effectively the same as the klp_have_reliable_stack() > check which is done in kernel/livepatch/core.c. So I think it would be > clearer and more consistent if the same check is done here: > > if (!klp_have_reliable_stack()) > return -ENOSYS; > > ret = save_stack_trace_tsk_reliable(task, &trace); > > [ no need to check ret for ENOSYS here ] > > Then, IMO, no comment is needed. BTW, if you agree with this approach then we can leave the WARN_ON_ONCE() in save_stack_trace_tsk_reliable() after all. -- Josh