From patchwork Wed Aug 19 02:56:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 31625 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D4F6DB708C for ; Wed, 19 Aug 2009 13:12:51 +1000 (EST) Received: by ozlabs.org (Postfix) id BF9A3DDD1B; Wed, 19 Aug 2009 13:12:51 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 47FBADDD01 for ; Wed, 19 Aug 2009 13:12:51 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751937AbZHSDMp (ORCPT ); Tue, 18 Aug 2009 23:12:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751948AbZHSDMp (ORCPT ); Tue, 18 Aug 2009 23:12:45 -0400 Received: from tomts23-srv.bellnexxia.net ([209.226.175.185]:34726 "EHLO tomts23-srv.bellnexxia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751937AbZHSDMo (ORCPT ); Tue, 18 Aug 2009 23:12:44 -0400 X-Greylist: delayed 981 seconds by postgrey-1.27 at vger.kernel.org; Tue, 18 Aug 2009 23:12:44 EDT Received: from toip7.srvr.bell.ca ([209.226.175.124]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20090819025624.UDZD6916.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> for ; Tue, 18 Aug 2009 22:56:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsFABcHi0pMRdTz/2dsb2JhbACBUtZthBkFgU6IWw Received: from bas5-montreal19-1279644915.dsl.bell.ca (HELO krystal.dyndns.org) ([76.69.212.243]) by toip7.srvr.bell.ca with ESMTP; 18 Aug 2009 22:59:18 -0400 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by krystal.dyndns.org with local; Tue, 18 Aug 2009 22:56:23 -0400 id 0001C6C5.4A8B69D7.0000407B Date: Tue, 18 Aug 2009 22:56:23 -0400 From: Mathieu Desnoyers To: "David S. Miller" , Jakub Jelinek Cc: sparclinux@vger.kernel.org, ltt-dev@lists.casi.polymtl.ca Subject: sparc: sys32.S incorrect compat-layer splice() system call Message-ID: <20090819025623.GA11677@Krystal> Mime-Version: 1.0 Content-Disposition: inline X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.6.27.31-grsec (i686) X-Uptime: 21:57:26 up 12:46, 4 users, load average: 0.31, 0.22, 0.19 User-Agent: Mutt/1.5.18 (2008-05-17) Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Hi David, I just installed a shiny (old) Sparc64 machine, trying to get LTTng to run on it (2.6.30 kernel), and noticed this problem when extracting the buffers: lttd (the daemon) causes faults in __copy_from_user() within splice(). lttd is compiled as a 32-bits process on my system. The kernel is 64-bits kernel. I think arch/sparc/kernel/sys32.S has an incorrect splice definition: SIGN2(sys32_splice, sys_splice, %o0, %o1) The splice() prototype looks like : long splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags); So I think we should have : SIGN2(sys32_splice, sys_splice, %o0, %o2) instead, am I correct ? BTW, I can't figure out why we have %o5 in : SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) which takes only 4 arguments: int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags); maybe it has something to do with the return value ? Anyway it should not hurt if it is unused. I provide the patch for splice() below. With this patch applied, I have been able to gather a trace with LTTng and view it in LTTV. Next steps for LTTng support on sparc64 are to add the syscall and trap instrumentation. Thanks, Mathieu sparc: sys32.S incorrect compat-layer splice() system call I think arch/sparc/kernel/sys32.S has an incorrect splice definition: SIGN2(sys32_splice, sys_splice, %o0, %o1) The splice() prototype looks like : long splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags); So I think we should have : SIGN2(sys32_splice, sys_splice, %o0, %o2) Signed-off-by: Mathieu Desnoyers CC: "David S. Miller" CC: Jakub Jelinek --- arch/sparc/kernel/sys32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6-lttng/arch/sparc/kernel/sys32.S =================================================================== --- linux-2.6-lttng.orig/arch/sparc/kernel/sys32.S 2009-08-18 21:21:20.000000000 -0400 +++ linux-2.6-lttng/arch/sparc/kernel/sys32.S 2009-08-18 21:56:47.000000000 -0400 @@ -134,7 +134,7 @@ SIGN1(sys32_getpeername, sys_getpeername SIGN1(sys32_getsockname, sys_getsockname, %o0) SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1) SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2) -SIGN2(sys32_splice, sys_splice, %o0, %o1) +SIGN2(sys32_splice, sys_splice, %o0, %o2) SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) SIGN2(sys32_tee, sys_tee, %o0, %o1) SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)