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,URIBL_BLOCKED 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 2D00FC433E4 for ; Sat, 25 Jul 2020 10:21:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E1C1E206EB for ; Sat, 25 Jul 2020 10:21:15 +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="fCRC7859" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1C1E206EB 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 58FC96B0002; Sat, 25 Jul 2020 06:21:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 519576B0003; Sat, 25 Jul 2020 06:21:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E09D6B0006; Sat, 25 Jul 2020 06:21:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 24D756B0002 for ; Sat, 25 Jul 2020 06:21:15 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CDD8A8248047 for ; Sat, 25 Jul 2020 10:21:14 +0000 (UTC) X-FDA: 77076205668.11.dress93_0b06fdd26f4f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id A0171184875C8 for ; Sat, 25 Jul 2020 10:21:14 +0000 (UTC) X-HE-Tag: dress93_0b06fdd26f4f X-Filterd-Recvd-Size: 5262 Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sat, 25 Jul 2020 10:21:14 +0000 (UTC) Received: by mail-ej1-f66.google.com with SMTP id g11so619197ejr.0 for ; Sat, 25 Jul 2020 03:21: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=missdBsNUzT7ukHWexKwYjiaX2t9R6jTrHE5vOnris8=; b=fCRC7859xWOSbmhU4JKMCe+akFDWIyPM7HAKB7nU55UPjnpS/tGtO7rZE+MhfZB0Bt 8U8Wz/5zhFEDQfnQH8/dZhyml4+1go+4t2QL13eB53s1B3OgARiKuu0ARZrm4ZVZMAvG pqUh3m+EzE04nIceDtofchMlX3oNWsSqEDUrd6tZlexJw85bhjKQ30Tqu4D0FUtrJG1+ /DCqtBGF0sp3p1Gqh92PRQ/SUEpgqaOfBY1NSn/fcLC7rzifhOmIoIjLlm76s/Zp0H7I fNVMy1K/Naw5Q08yS5vesNwJnwxu0iuONkI4J9Dt2RccNkL/6ynBNcCgJwfFxkTy56yD MFTQ== 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=missdBsNUzT7ukHWexKwYjiaX2t9R6jTrHE5vOnris8=; b=KwWvkexPq4uLqBRV1TySfzpX2sB0tzrTU4XKP6kChb4d1RqdVxVlxOrvIhyRdZLWkt oWwzrDo1aetiX2EdFjxzcUiJXxiJaUVow0ncNUg9AKpjoI2kwBSsZYwrUAZzap2Gawy/ 79LmKxoBU6EisvzQoIhWpYLEXThF6W5JyPKABxhEN9QhUV0r2HA6nDYfojt+Ve33YwmO xVw/m+vIi2m9OcOsxWAUWnrwUaKATULQAUwAD2uW6ku5TCyszbtk+byMjc39wV5tMEzn YAzOiopGbLcfF/lm63tA8Wvx56u/qL5+TFda26589ic3wEhnCejCaOqv0Fd1+mYlu9P8 9LNA== X-Gm-Message-State: AOAM532wGocJAtSruPf2BXORNc+2k/aGqixR38IoTl0OjQj7XJFxT16d TAqeywkr0vaBo02U+osugsM= X-Google-Smtp-Source: ABdhPJx407E1T3MUmslE6VBYvrrgVuh+hSPQmhXYtTVqRvBkBBl4j1YkzdCwe9/0Qjrceq6yTr7DKg== X-Received: by 2002:a17:906:8595:: with SMTP id v21mr13457349ejx.333.1595672473007; Sat, 25 Jul 2020 03:21:13 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id i7sm2605033eds.91.2020.07.25.03.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jul 2020 03:21:12 -0700 (PDT) Date: Sat, 25 Jul 2020 12:21:10 +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: <20200725102110.GA757173@gmail.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> <20200724091711.GB517988@gmail.com> <20200725030107.GF17052@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200725030107.GF17052@linux.intel.com> X-Rspamd-Queue-Id: A0171184875C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000217, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: * Jarkko Sakkinen wrote: > On Fri, Jul 24, 2020 at 11:17:11AM +0200, Ingo Molnar wrote: > > > > * 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 > > AFAIK, only if you need to call find_module(), you ever need to acquire > this mutex. 99% of time it is internally taken care by kernel/module.c. > > I cannot make up any obvious reason to acquire it here. If it's unnecessary, then it needs to be removed. If it's necessary, then it needs to be documented better. Thanks, Ingo