Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2019391ybh; Fri, 24 Jul 2020 02:18:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1nlq/Dt2laVlfS7ZpjmUUjXIe0DIA1qi2utmVoThJFRq03VzWWmrOQZXxuk1ZLU2BjNRs X-Received: by 2002:a17:906:fac3:: with SMTP id lu3mr8694376ejb.374.1595582295105; Fri, 24 Jul 2020 02:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595582295; cv=none; d=google.com; s=arc-20160816; b=twVulSR1I4L6Y8t5seKluOnR30nL9vjwpXp0CKLQgwWFz9L3maye1DYXiKT12vigFR WyyPVdv0dIQAtaYZB2BIPLMp1Gb8412tLn5nyNBZUQJTm5RQBTOLMJTbFbBaJ7NpjypU 6f+3gr9P1Yl4j6DE+EVyCBocE4g6udIr77h+FGjZNuMAaW+zSpfkyhT3YrywdZr5acIh iJ0UXI4iDUUvs1J13GhOMYyuUWovZ6cYiaWvORb0BiyjjfViuGtAAksL06cawHrKcYMK PcgKVpCiexm3Fma7cAlW3jdhWrP/G+/nvy7NfHuwLLl+ia4pOG4Yg3Ug+/YKTRTxeUjh oMLw== 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 :dkim-signature; bh=/OC350Q0A9R/G9QPy9dkketdGLXiYUcXoiXvxtiFS3I=; b=Kx0beOn7CQXanWPcQC+S3vj4zXOG/7BRXViIm+bZtKc+qtCGfNrGp4S0DQOHmTesym kcZCC8OoRngjZvaweeMq4CnAoxtJuqDxH1fAUUMsQ6PRk1/RPRZh74CPlNusLXgVTcmU jRvvD6Nw+EHgDLTKjiRfmAOxhW9Qcx3F9O3ejre9mZwPVeAz2YQ192mqrfPQXLX1mwdV vYpKyHOWP+l88tZOrRpd6z6hhQyoB8GAkeRRTTltJLJnLCfiIwB5nJdoq5XHoN8PFclK KUBEf1QDUn8eG2rAaRhhhdUPD5S/aKUPpiQIyfNIX/kpVfcWSOipsjptHpipiCEtPgyu WlmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=chuTST1J; 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 r20si154805edy.598.2020.07.24.02.17.52; Fri, 24 Jul 2020 02:18:15 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=chuTST1J; 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 S1728024AbgGXJRP (ORCPT + 99 others); Fri, 24 Jul 2020 05:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbgGXJRP (ORCPT ); Fri, 24 Jul 2020 05:17:15 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C75FC0619D3 for ; Fri, 24 Jul 2020 02:17:15 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id f12so9246423eja.9 for ; Fri, 24 Jul 2020 02:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/OC350Q0A9R/G9QPy9dkketdGLXiYUcXoiXvxtiFS3I=; b=chuTST1JaqOVT7yYQunPdIWjX5K7+V3f26TOUaT4KfzOSmf0pRhB9CnodvRIf/ombz Bxw5TQ9jSLFkknPnQYCUXvfuOMFTBb9K65ELT2jsylkPekxy/bOlU0C1c78dhTmMePsA PlNNVcPa31LsjUFOmI79sHMe09phtsApgsxDD2xxYH7Wy2oPpRHhC4PhsZAs0a77TIGb Aa4ApPuru4kGYdqJ2ihY2lhuMLJnyeN1w6qUG62Zp+mCktHh+gVest/yTVxkZGNd61a/ 6gu0WeAoM1Yb4Zp4dU9+tdw7XHas/8Y3HYvS9hWtWUEiZiOkeDgGVP4fHTEocjq+E1ie bKnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=/OC350Q0A9R/G9QPy9dkketdGLXiYUcXoiXvxtiFS3I=; b=WrmAu7viA/P8cgKfLCo0uPY7m+tXkzgcUjR72a7IzhOb2sYjv0RqF0pf72gEe2HkFi TxEnc5GvcKmOjbcwWY1sXvAYH1BB+vDGbf5p70Hygp20S1Yfy0QYaX3ShNmlStqWQ06+ CPVhS8hlrlPcFCzqNjaMbShgGd7xE+vt9Dk53d9ocGqbsuvOqPywcydWUXEBFOPY428A 2YP4/5bIkQrHkL/OtIGGas2kgfGnwJfAIPl8zAua5sBbFzOJX9o4X6YfXcThs2/NyvEY /46i6UlJPSYrjqCq+8+9r9cE+oRt0ahcGi4UL+48mEv0pQzkPKT+T/M8jR2AD1e3brqJ SVEw== X-Gm-Message-State: AOAM532QrcfP5M6kovwBy4z75VfjDFM41Ssj427Wv8A3MIuNDwrOa7bE 3OHq+7VYOqOm7HLVzM9NatU= X-Received: by 2002:a17:906:6499:: with SMTP id e25mr8186466ejm.352.1595582234028; Fri, 24 Jul 2020 02:17:14 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id v5sm296033ejj.61.2020.07.24.02.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 02:17:13 -0700 (PDT) Date: Fri, 24 Jul 2020 11:17:11 +0200 From: Ingo Molnar To: Jarkko Sakkinen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andi Kleen , Peter Zijlstra , Masami Hiramatsu , Jessica Yu , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Steven Rostedt , Ingo Molnar Subject: Re: [PATCH v5 1/6] kprobes: Remove dependency to the module_mutex Message-ID: <20200724091711.GB517988@gmail.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jarkko Sakkinen wrote: > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -564,7 +564,7 @@ static void kprobe_optimizer(struct work_struct *work) > cpus_read_lock(); > mutex_lock(&text_mutex); > /* Lock modules while optimizing kprobes */ > - mutex_lock(&module_mutex); > + lock_modules(); > > /* > * Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed) > @@ -589,7 +589,7 @@ static void kprobe_optimizer(struct work_struct *work) > /* Step 4: Free cleaned kprobes after quiesence period */ > do_free_cleaned_kprobes(); > > - mutex_unlock(&module_mutex); > + unlock_modules(); > mutex_unlock(&text_mutex); > cpus_read_unlock(); BTW., it would be nice to expand on the comments above - exactly which parts of the modules code is being serialized against and why? We already hold the text_mutex here, which should protect against most kprobes related activities interfering - and it's unclear (to me) which part of the modules code is being serialized with here, and the 'lock modules while optimizing kprobes' comments is unhelpful. :-) Thanks, Ingo