Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbdGFNMx (ORCPT ); Thu, 6 Jul 2017 09:12:53 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:43422 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbdGFNMw (ORCPT ); Thu, 6 Jul 2017 09:12:52 -0400 Date: Thu, 6 Jul 2017 14:12:37 +0100 From: "Maciej W. Rozycki" To: James Hogan CC: Aleksandar Markovic , , Goran Ferenc , Miodrag Dinic , Aleksandar Markovic , Douglas Leung , , Paul Burton , Petar Jovanovic , Raghu Gandham , Ralf Baechle Subject: Re: [PATCH v2 2/4] MIPS: VDSO: Add implementation of clock_gettime() fallback In-Reply-To: <20170706090553.GO31455@jhogan-linux.le.imgtec.org> Message-ID: References: <1498665337-28845-1-git-send-email-aleksandar.markovic@rt-rk.com> <1498665337-28845-3-git-send-email-aleksandar.markovic@rt-rk.com> <20170706090553.GO31455@jhogan-linux.le.imgtec.org> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.20.78.101] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1374 Lines: 38 On Thu, 6 Jul 2017, James Hogan wrote: > > > + asm volatile( > > > + " syscall\n" > > > + : "=r" (ret), "=r" (error) > > > + : "r" (clkid), "r" (ts), "r" (nr) > > > + : "memory"); > > > + > > > + return error ? -ret : ret; > > > +} > > > > Hmm, are you sure it is safe nowadays WRT the syscall restart convention > > to leave out the instruction explicitly loading the syscall number that > > would normally immediately precede SYSCALL > > It should be fine. syscall restart only rewinds one (32-bit) > instruction, and it preserves the syscall number in pt_regs::regs[0] > (see handle_signal() / do_signal() and this code in e.g. scall32-o32.S:) > > sw t1, PT_R0(sp) # save it for syscall restarting Fair enough, I just wanted to be sure. [This user code is bundled with the kernel, so it can assume whatever the kernel does, however general user code does have to conform to the legacy restart convention, unless it also requires a kernel version that is new enough and has a safety check in place.] > > (and would have to forcibly use the 32-bit encoding in the microMIPS > > case)? > > I don't believe there is a 16-bit SYSCALL encoding in microMIPS, at > least I can't see one in the 5.04 manual. I referred to the preceding instruction, presumably LI, that does have a 16-bit variant in the microMIPS instruction set. Maciej