From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CDC3C433E0 for ; Fri, 24 Jul 2020 09:17:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C62BA2063A for ; Fri, 24 Jul 2020 09:17:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="chuTST1J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C62BA2063A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 21F736B0024; Fri, 24 Jul 2020 05:17:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A9038D0008; Fri, 24 Jul 2020 05:17:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 021FA6B0026; Fri, 24 Jul 2020 05:17:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id DE40F6B0024 for ; Fri, 24 Jul 2020 05:17:15 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9DD42276F2 for ; Fri, 24 Jul 2020 09:17:15 +0000 (UTC) X-FDA: 77072415630.09.head83_100c10726f46 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 7AA7F180278A8 for ; Fri, 24 Jul 2020 09:17:15 +0000 (UTC) X-HE-Tag: head83_100c10726f46 X-Filterd-Recvd-Size: 4583 Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Jul 2020 09:17:14 +0000 (UTC) Received: by mail-ej1-f67.google.com with SMTP id c10so1114999ejs.5 for ; Fri, 24 Jul 2020 02:17:14 -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=HFXLQfWFS3BZMoFO27chpx49rk+T+AnVuGHLxL8Uuy/+vV1JrjfBsNm1zOI9Or/Yjv scLHYmw0flNavTbx8RZ4bsCQZZqrCsuQJr6LtUuAcEtEy1imqQ5FKpWP3Xf8r/K2rAqK Cm3v3bNFOX1G2/oIWBYNZA3N0dXppmTTGSmIS1rigYVSAj6w7v2838wcxwq+lwceZ8Um Gk7JgvjpWbvKoCqcVqdf8yxjBjK7ygtt8AgXO/duv31IUfg/hwKKOUeIyRSqWtHHwolQ ZiTiyD6t5e6hwp4ikDrBs5vlRtGi9L4HpzyoMvpj4Ha8KjnIJ5GQ2JoeT+vnABTP7LTL t2YA== X-Gm-Message-State: AOAM533CmH0ARto157uQMUwFOIfgcZ2+GnmD3dRvYjbP/zRFX0HQ3DLj eScbFfk2suQ7vmYvmi8wkYE= X-Google-Smtp-Source: ABdhPJzwOcbamfMswXat/5I2ZGN5RwAMcwz8bdlQYVANNSSFvVtSOr/BB0E/b8cwXbRRmp3FTOgzLg== 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> X-Rspamd-Queue-Id: 7AA7F180278A8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: * 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