Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp607417ybi; Wed, 19 Jun 2019 05:02:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8yJsQ4LpAHm/2u5ursrANX+2lapnJOK9tgUm3ocAHIHXp90JRtKLXmUwKF4NwpUmECyK2 X-Received: by 2002:a17:90a:ad93:: with SMTP id s19mr10848657pjq.36.1560945760272; Wed, 19 Jun 2019 05:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560945760; cv=none; d=google.com; s=arc-20160816; b=wqC+iicxorfBwWUju0ZzYgZQ5Hpbkc6uD1uinJieCQBxS7kUTaHZoSbdimBb+h5LvT vVMSMh4LGO/UzugRF8ptS3azf8hizBawayVlnsHfGqid5VsRyWQL9q89dNQachQLjJKH 9nkpDB45KwBqRkUPYfVFv7pZ874cclwAZzdd7cbw7tjd8nROdPCfnURRssAYcIAIqaXM GzNmHl8UB8B+jMDHiCgbsyL9H3OZPKr+jHYMHMN2RChEU6X89lJEEKGhqbdPv4qUoc6O b5J0bgjOCfE8NzM6ON+/v6pZL4J07BmAp/QUyPjltLIE8oYJHCj2C3fjrktl2djPFznQ 2b/w== 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; bh=ri7qjhjVCgbjO6ig3doTj7RVbO2jjytVB0LcoWHrHhU=; b=FRXsm1fmImxoja42e4xpOfTXWOqtX/fOcH/npaYsVCwPfNxbzE5kJLbsg5fPUGbJxF 0ztx47cVMvm43RStvj31PYKhJrgSjq52RLeILAESI+U81ft/3elXyV9bCaTZoLtuqOM8 j8jHBBXcIWPcOuyAIFP1Okb7DMAfJsZr77h47yONowe1g6E3QaHESSCLwYm7Fc+6hICL re1/3R2rOFUbzxyBodEXRFhgCZQHFGsTRyxR8mklCH4wAuxs+AjO7z0ZxvTUZN/gvqZX n4ry5ZZgRjf3m4IVtH8fZ8xnj+t9j4ElcgL/iNWgGjdEWx3tZx5QgroTYL+GNzbuvWHK UzcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=FcgOzzaU; 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 f24si2860712pgi.289.2019.06.19.05.02.21; Wed, 19 Jun 2019 05:02:40 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=FcgOzzaU; 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 S1731328AbfFSMCE (ORCPT + 99 others); Wed, 19 Jun 2019 08:02:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44618 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbfFSMCE (ORCPT ); Wed, 19 Jun 2019 08:02:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ri7qjhjVCgbjO6ig3doTj7RVbO2jjytVB0LcoWHrHhU=; b=FcgOzzaUp3Q5CfIuOaKoL+MDK KYCzrxCmEMdfjNQSrLlvvwFbZrSjOWK3jSgSFnTe+ewKfop5MWztgIuCls6ghDvHF0Qem3tYDpX/7 AIZGONFJINJi/oYjy23u7u/yTrkGtoMRLk/IR9AJG5/yFV4c4SeCcZroBm8mbs5ENlLckoz1WK96K Nm+9k30Tfq9+JtM7kkfqZWWi7T9DZYxNwGc38WqEK44vn8z7W4l9EWSzv4y1Ic2LfM7KHDlimJkIA LiCGZk5VfImotto+QulyqEy3vwqM0SKLUITsKvVrLvUW2EDp1GxWLni53nccRpPNu2GGFUWTLzJaF eS+nqrQbA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hdZHR-0008GE-3H; Wed, 19 Jun 2019 12:01:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7A0272020FD6B; Wed, 19 Jun 2019 14:01:31 +0200 (CEST) Date: Wed, 19 Jun 2019 14:01:31 +0200 From: Peter Zijlstra To: Miroslav Benes Cc: Jessica Yu , linux-kernel@vger.kernel.org, jpoimboe@redhat.com, jikos@kernel.org, pmladek@suse.com, rostedt@goodmis.org, ast@kernel.org, daniel@iogearbox.net, "Rafael J. Wysocki" Subject: Re: [RFC][PATCH] module: Propagate MODULE_STATE_COMING notifier errors Message-ID: <20190619120131.GS3463@hirez.programming.kicks-ass.net> References: <20190617090335.GX3436@hirez.programming.kicks-ass.net> <20190619112350.GN3419@hirez.programming.kicks-ass.net> <20190619113324.GO3463@hirez.programming.kicks-ass.net> <20190619113508.GP3463@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190619113508.GP3463@hirez.programming.kicks-ass.net> 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 Wed, Jun 19, 2019 at 01:35:08PM +0200, Peter Zijlstra wrote: > On Wed, Jun 19, 2019 at 01:33:24PM +0200, Peter Zijlstra wrote: > > How's something like so: > > > > diff --git a/kernel/module.c b/kernel/module.c > > index 80c7c09584cf..eba6560c89da 100644 > > --- a/kernel/module.c > > +++ b/kernel/module.c > > @@ -3631,16 +3631,28 @@ static int complete_formation(struct module *mod, struct load_info *info) > > > > static int prepare_coming_module(struct module *mod) > > { > > - int err; > > + struct blocking_notifier_head *nh = &module_notify_list; > > + int err, nr; > > > > ftrace_module_enable(mod); > > err = klp_module_coming(mod); > > if (err) > > return err; > > > > - blocking_notifier_call_chain(&module_notify_list, > > - MODULE_STATE_COMING, mod); > > - return 0; > > + if (!rcu_access_pointer(nh->head)) > > + return 0; > > + > > + down_read(&nh->rwsem); > > + ret = notifier_call_chain(&nh->head, MODULE_STATE_COMING, mod, -1, &nr); > > + if (ret & NOTIFIER_STOP_MASK) > > It compiles _lots_ better with s/ret/err/ on. > > > + notifier_call_chain(&nh->head, MODULE_STATE_GOING, mod, nr, NULL); > > + up_read(&nh->rwsem); > > + > > + err = notifier_to_err(err); > > + if (err) > > + klp_module_going(mod); > > + > > + return err; > > } > > > > static int unknown_module_param_cb(char *param, char *val, const char *modname, Rafael, how is kernel/power/user.c snapshot_open() not broken (any any other __pm_notifier_call_chain() user)? afaict the __pm_notifier_call_chain() thing is broken in two ways: - there can be a change to the notifier list between the PREPARE and POST iteration - the error value isn't put through notifier_to_errno().