From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764342AbcLTPVv (ORCPT ); Tue, 20 Dec 2016 10:21:51 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:49852 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752325AbcLTPVs (ORCPT ); Tue, 20 Dec 2016 10:21:48 -0500 Subject: Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation To: Oleg Nesterov , tip-bot for Marcin Nowakowski References: <1481625657-22850-1-git-send-email-marcin.nowakowski@imgtec.com> <20161220130820.GA24822@redhat.com> CC: , , , , , , , , , , , From: Marcin Nowakowski Message-ID: <8707b178-15e0-1ca0-5612-f42d771446cc@imgtec.com> Date: Tue, 20 Dec 2016 16:21:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161220130820.GA24822@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.2.5] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Oleg, On 20.12.2016 14:08, Oleg Nesterov wrote: > On 12/19, tip-bot for Marcin Nowakowski wrote: >> >> uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation >> >> Commit: >> >> 72e6ae285a1d ('ARM: 8043/1: uprobes need icache flush after xol write' >> >> ... has introduced an arch-specific method to ensure all caches are >> flushed appropriately after an instruction is written to an XOL page. > > when this page is already mmaped, > >> However, when the XOL area is created and the out-of-line breakpoint >> instruction is copied, caches are not flushed at all and stale data may >> be found in icache. > > but in this case the page is not mmaped yet, the probed application will > take a page fault if it tries to execute this insn, In case of MIPS (and AFAICT ARM as well, and these are the only architectures that implement arch_uprobe_copy_ixol), the cache flushing is done through the kernel addresses of that page, so the fact that it is not mapped yet is not an issue. Do I understand correctly that your statement implies that after the page fault and mmapping the xol page, the page is guaranteed to be updated in the cache? As definitely that is not something that is happening at the moment. >> Replace a simple copy_to_page() with arch_uprobe_copy_ixol() to allow >> the arch to ensure all caches are updated accordingly. >> >> This change fixes uprobes on MIPS InterAptiv (tested on Creator Ci40). > > OK, I know nothing about MIPS, but could you help me understand this change? > > See above. If we really need flush_icache_range() here then perhaps we should > modify install_special_mapping() and/or __do_fault/special_mapping_fault paths > instead? Are you suggesting that those should be updated to force a cache update? Marcin