Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp854739ybz; Wed, 29 Apr 2020 10:32:44 -0700 (PDT) X-Google-Smtp-Source: APiQypKKe+m7zd1js/Z2/0deQbjKNXoqVm4N+pi6i8rO9kzXmVHYmnOwLwZ257+EipbD5p3xwN5G X-Received: by 2002:a05:6402:b03:: with SMTP id bm3mr3372613edb.299.1588181564581; Wed, 29 Apr 2020 10:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588181564; cv=none; d=google.com; s=arc-20160816; b=nVp1JEIAhNqLJRguHgloJzNjw1+XRTLhHH3hSnzimsmjzSs+pWrwVlpHF1nFFPMMKn U9z9pG6vUBWJ37ofLpL743lRfvIoI0Asv4YQa5sbnQGOpVhZg/0xZFmxR3nF2kkAx36m MpMQfLUYkleS44uXARtsj607h+/DEMily+QE/TWFpIxXmCOGZgIKGjARSd7PLEVaycpP vsnw9SdmsRHBJeb/BrYT1tZtKqMkkWpzpmx4rD9Z9SP92rCvBEqOtHsCo6Lhd5pFVWZR jNvid2rBAzvoi0/MTWRGSBHPqCtfdUfgpszbLgCgPpdNCkPf6A3YjlNmwq2ez0ZC0nFi R6IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=D1YIauERmx7u1Xcu9eVlzjzTdRrs1DrzoctdbB6KdM0=; b=w90kDOSNDqvSjpO95EMzA8+LQA0cgLfLtbnpuBSlHEOoSu8MPnhS6XIKglHGuurPSJ iNIiFdvp6TqHVQrQRYyJaa7J7O90B/3UOLElfzIzslGLxVO1v4hdVti7TsFyG9xICfsw UAXZFV7COrXLlPCFAGmRQHi3jffz0NceDGPlrRYPh2GzM50D7v9Hhg50qlEazTLpYn5A /F7kAAojxcvx4C0Gj8RR52xR7CJVvcXmfLChZSM1tqeRcX2m9p0O8K9U/TBaLEMfyEvG w7FTcwbUE2buDpb/ZDbTyFv+4LuZhTxyNWtaIG+Itie194mgvdH2AcRfOfvLSCVbES63 SQ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=K6geIgU7; 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=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si4023318eds.361.2020.04.29.10.31.55; Wed, 29 Apr 2020 10:32:44 -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=pass header.i=@efficios.com header.s=default header.b=K6geIgU7; 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=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbgD2R3s (ORCPT + 99 others); Wed, 29 Apr 2020 13:29:48 -0400 Received: from mail.efficios.com ([167.114.26.124]:38294 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726580AbgD2R3r (ORCPT ); Wed, 29 Apr 2020 13:29:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 9AA19294F4F; Wed, 29 Apr 2020 13:29:46 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wV5krUHBi7wo; Wed, 29 Apr 2020 13:29:46 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 40FDA294F4E; Wed, 29 Apr 2020 13:29:46 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 40FDA294F4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1588181386; bh=D1YIauERmx7u1Xcu9eVlzjzTdRrs1DrzoctdbB6KdM0=; h=Date:From:To:Message-ID:MIME-Version; b=K6geIgU71fgZlYvhOJM7l6fYqsCXHDru8cfCuvKK1PiXigLG4tKAB8U+cYaoJsXBT ywB9PVBmR4M264nW3U8T90sqpqGR7Hria3Nw8Y+Uw+ISr0s+BxrQKZcNSFaJABTOOD zldAHt6pKag764XmA9wJu+fNJ4Romd2XNDr0ntnk2r+TNn3lzczmiYXkvpDcsNfueY RXzs5Uy2ib1Z7WT2ogoWpi3N1vul76XCN2zcz3XX+ifNUimJDUTfiorBBIPff4I/xf N7eYKzfUn7hyoWzq/nQHkh1cRjrkx2m9nQPFjtXrrnf9uJyQv5wI7A4v5tFNXgYjo6 AqivUff9WIlIA== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wM9fp5kTRvk8; Wed, 29 Apr 2020 13:29:46 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 2D22A29528E; Wed, 29 Apr 2020 13:29:46 -0400 (EDT) Date: Wed, 29 Apr 2020 13:29:46 -0400 (EDT) From: Mathieu Desnoyers To: rostedt Cc: Joerg Roedel , linux-kernel , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Borislav Petkov , Andrew Morton , Shile Zhang , Andy Lutomirski , "Rafael J. Wysocki" , Dave Hansen , Tzvetomir Stoyanov Message-ID: <951556503.76104.1588181386082.JavaMail.zimbra@efficios.com> In-Reply-To: <20200429125245.5a804f62@gandalf.local.home> References: <20200429054857.66e8e333@oasis.local.home> <20200429105941.GQ30814@suse.de> <20200429082854.6e1796b5@oasis.local.home> <20200429100731.201312a9@gandalf.local.home> <20200429161747.GS30814@suse.de> <20200429162026.GT30814@suse.de> <20200429125245.5a804f62@gandalf.local.home> Subject: Re: [RFC][PATCH] x86/mm: Sync all vmalloc mappings before text_poke() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3918 (ZimbraWebClient - FF75 (Linux)/8.8.15_GA_3895) Thread-Topic: x86/mm: Sync all vmalloc mappings before text_poke() Thread-Index: jcBEkkna6hZ/plK+1lnYOdJw4aPR+g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Apr 29, 2020, at 12:52 PM, rostedt rostedt@goodmis.org wrote: > On Wed, 29 Apr 2020 18:20:26 +0200 > Joerg Roedel wrote: > >> On Wed, Apr 29, 2020 at 06:17:47PM +0200, Joerg Roedel wrote: >> > On Wed, Apr 29, 2020 at 10:07:31AM -0400, Steven Rostedt wrote: >> > > Talking with Mathieu about this on IRC, he pointed out that my code does >> > > have a vzalloc() that is called: >> > > >> > > in trace_pid_write() >> > > >> > > pid_list->pids = vzalloc((pid_list->pid_max + 7) >> 3); >> > > >> > > This is done when -P1,2 is on the trace-cmd command line. >> > >> > And that buffer is written to at any function entry? >> >> What I meant to say, is it possible that the page-fault handler does not >> complete because at its beginning it calls into trace-code and faults >> again on the same address? >> > > It should be read only at sched_switch. > > Basically, it's a big bitmask, where each bit represents a possible process > id (can be 2 gigs if we allow all positive ints!). I think you mean 2 giga-bit, for 256MB worth of memory, right ? And AFAIU the PID_MAX_LIMIT is at a maximum of 4 million PIDs in include/linux/threads.h, which means 512MB worth of memory for a bitmask. > Then, it is only written when setting it up. Bits 1 and 2 are set here > (-P1,2). At context switch, next->pid is checked against this bitmask, and > if it is set, it means we should allow this process to be traced. > > This mask should only be accessed at sched_switch time, not at other times. > And it may read any possible page in that mask depending on the process id > of the next task to be scheduled in. Not sure how relevant it is, but I notice that it is also touched from IPI context, see: on_each_cpu(ignore_task_cpu, tr, 1); Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com