From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbbEABai (ORCPT ); Thu, 30 Apr 2015 21:30:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33776 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751485AbbEABaf (ORCPT ); Thu, 30 Apr 2015 21:30:35 -0400 Message-ID: <5542D730.2050903@redhat.com> Date: Thu, 30 Apr 2015 21:30:24 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: =?UTF-8?B?RnLpppjpp7tpYyBXZWlzYmVja2Vy?= CC: Andy Lutomirski , X86 , linux-kernel@vger.kernel.org, Thomas Gleixner , Denys Vlasenko Subject: context tracking vs. syscall_trace_leave & do_notify_resume loop Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andy pointed out to me something I should have seen earlier: both syscall_trace_leave and do_notify_resume call both user_exit() and user_enter(), which has the potential to greatly increase the cost of context tracking. I believe (though it is hard to know for sure) there are legitimate reasons why there is a loop around syscall_trace_leave and do_notify_resume, but I strongly suspect the context tracking code does not need to be in that loop. I suspect it would be possible to stick a call to a new function (return_to_user ?) right after the DISABLE_INTERRUPTS below, which could be used to do the context tracking user_enter just once, and later on also to load the user FPU context (patches I have sitting around). syscall_return: /* The IRETQ could re-enable interrupts: */ DISABLE_INTERRUPTS(CLBR_ANY) TRACE_IRQS_IRETQ Andy, Denys, do you guys see any issues with that idea? I realize that would mean a RESTORE_EXTRA_REGS after that call to return_to_user(), but it looks like that could be achieved without making the code any worse than it already is :) -- All rights reversed