From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755210AbdJIVMC (ORCPT ); Mon, 9 Oct 2017 17:12:02 -0400 Received: from 20pmail.ess.barracuda.com ([64.235.150.247]:51629 "EHLO 20pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755196AbdJIVMA (ORCPT ); Mon, 9 Oct 2017 17:12:00 -0400 Date: Mon, 9 Oct 2017 22:09:24 +0100 From: James Hogan To: Aleksandar Markovic CC: , Aleksandar Markovic , Douglas Leung , Goran Ferenc , , "Maciej W. Rozycki" , Manuel Lauss , Masahiro Yamada , Miodrag Dinic , Paul Burton , Petar Jovanovic , "Raghu Gandham" , Ralf Baechle Subject: Re: [PATCH 1/2] MIPS: math-emu: Update debugfs FP exception stats for certain instructions Message-ID: <20171009210923.GA20378@jhogan-linux> References: <1507310955-3525-1-git-send-email-aleksandar.markovic@rt-rk.com> <1507310955-3525-2-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: <1507310955-3525-2-git-send-email-aleksandar.markovic@rt-rk.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-Originating-IP: [192.168.154.110] X-BESS-ID: 1507583412-637139-572-195538-4 X-BESS-VER: 2017.12-r1709122024 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.185837 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 06, 2017 at 07:29:00PM +0200, Aleksandar Markovic wrote: > From: Aleksandar Markovic >=20 > Fix omission of updating of debugfs FP exception stats for > instructions .. >=20 > CLASS. can generate Unimplemented Operation FP exception. > >. can generate Inexact, nit: s/>>/>/ > Unimplemented Operation, Invalid Operation, Overflow, and > Underflow FP exceptions. In such cases, and prior to this Well, according to the manual I'm looking at MAX|MIN|MAXA|MINA can't generate inexact, overflow, or underflow FP exceptions, and in practice the only FPE generated by emulating these instructions is invalid operation for MADDF/MSUBF. So presumably that's the only case we really care about. I.e. the MADDF/MSUBF invalid operation should be counted, but crucially the setting of rcsr bits allows it to generate a SIGFPE which from a glance it doesn't appear to do until this patch. The other changes are redundant and harmless. Does that sound correct? (appologies if I'm missing something, I'm just reading the code, and reading FPU emulation code late at night is probably asking for trouble). Given the potential fixing of SIGFPE in that case should this be tagged for stable? Thanks James > patch, debugfs FP exception stats were not updated, and > therefore contained overall wrong values. >=20 > This brings the emulation of mentioned instructions consistent > with the previously implemented emulation of other related > FPU instructions. >=20 > There is still some room for refactoring and improving the > code segment under label "copcsr", but this is beyond the > scope of this patch. >=20 > Fixes: 38db37ba069f ("MIPS: math-emu: Add support for the MIPS R6 CLASS F= PU instruction") > Fixes: e24c3bec3e8e ("MIPS: math-emu: Add support for the MIPS R6 MADDF F= PU instruction") > Fixes: 83d43305a1df ("MIPS: math-emu: Add support for the MIPS R6 MSUBF F= PU instruction") > Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A= } FPU instruction") > Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A= } FPU instruction") >=20 > Signed-off-by: Aleksandar Markovic > --- > arch/mips/math-emu/cp1emu.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) >=20 > diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c > index 192542d..d2fcb30 100644 > --- a/arch/mips/math-emu/cp1emu.c > +++ b/arch/mips/math-emu/cp1emu.c > @@ -1795,7 +1795,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(fs, MIPSInst_FS(ir)); > SPFROMREG(fd, MIPSInst_FD(ir)); > rv.s =3D ieee754sp_maddf(fd, fs, ft); > - break; > + goto copcsr; > } > =20 > case fmsubf_op: { > @@ -1809,7 +1809,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(fs, MIPSInst_FS(ir)); > SPFROMREG(fd, MIPSInst_FD(ir)); > rv.s =3D ieee754sp_msubf(fd, fs, ft); > - break; > + goto copcsr; > } > =20 > case frint_op: { > @@ -1834,7 +1834,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(fs, MIPSInst_FS(ir)); > rv.w =3D ieee754sp_2008class(fs); > rfmt =3D w_fmt; > - break; > + goto copcsr; > } > =20 > case fmin_op: { > @@ -1847,7 +1847,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(ft, MIPSInst_FT(ir)); > SPFROMREG(fs, MIPSInst_FS(ir)); > rv.s =3D ieee754sp_fmin(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmina_op: { > @@ -1860,7 +1860,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(ft, MIPSInst_FT(ir)); > SPFROMREG(fs, MIPSInst_FS(ir)); > rv.s =3D ieee754sp_fmina(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmax_op: { > @@ -1873,7 +1873,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(ft, MIPSInst_FT(ir)); > SPFROMREG(fs, MIPSInst_FS(ir)); > rv.s =3D ieee754sp_fmax(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmaxa_op: { > @@ -1886,7 +1886,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > SPFROMREG(ft, MIPSInst_FT(ir)); > SPFROMREG(fs, MIPSInst_FS(ir)); > rv.s =3D ieee754sp_fmaxa(fs, ft); > - break; > + goto copcsr; > } > =20 > case fabs_op: > @@ -2165,7 +2165,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(fs, MIPSInst_FS(ir)); > DPFROMREG(fd, MIPSInst_FD(ir)); > rv.d =3D ieee754dp_maddf(fd, fs, ft); > - break; > + goto copcsr; > } > =20 > case fmsubf_op: { > @@ -2179,7 +2179,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(fs, MIPSInst_FS(ir)); > DPFROMREG(fd, MIPSInst_FD(ir)); > rv.d =3D ieee754dp_msubf(fd, fs, ft); > - break; > + goto copcsr; > } > =20 > case frint_op: { > @@ -2204,7 +2204,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(fs, MIPSInst_FS(ir)); > rv.l =3D ieee754dp_2008class(fs); > rfmt =3D l_fmt; > - break; > + goto copcsr; > } > =20 > case fmin_op: { > @@ -2217,7 +2217,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(ft, MIPSInst_FT(ir)); > DPFROMREG(fs, MIPSInst_FS(ir)); > rv.d =3D ieee754dp_fmin(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmina_op: { > @@ -2230,7 +2230,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(ft, MIPSInst_FT(ir)); > DPFROMREG(fs, MIPSInst_FS(ir)); > rv.d =3D ieee754dp_fmina(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmax_op: { > @@ -2243,7 +2243,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(ft, MIPSInst_FT(ir)); > DPFROMREG(fs, MIPSInst_FS(ir)); > rv.d =3D ieee754dp_fmax(fs, ft); > - break; > + goto copcsr; > } > =20 > case fmaxa_op: { > @@ -2256,7 +2256,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips= _fpu_struct *ctx, > DPFROMREG(ft, MIPSInst_FT(ir)); > DPFROMREG(fs, MIPSInst_FS(ir)); > rv.d =3D ieee754dp_fmaxa(fs, ft); > - break; > + goto copcsr; > } > =20 > case fabs_op: > --=20 > 2.7.4 >=20 --YiEDa0DAkWCtVeE4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAlnb5XsACgkQbAtpk944 dnoqrA//f4Qffia5TjQuX0B62cn9q45AD2dU17iqxOyTO8ghkyKl00SFCcAZ3DAV 1X9YpBIGaVFMKOAOj+j8HxMKQMgrwygJeEwpSz7L8fC+6guyXNSlhQ5NyEswZs3u t2rPpn0xYDFA3m0bpacqvBrdtXU6jlSoTC5aE9GX+rxNiQpCQrQwWj+bTBGNNn3O FdgQsxVfqve3kdqyWlaAQ6cnm3NLLhnf6GPBBi5W76DRB7ZDTp3YGJ7YyZodEsBu Rql+nTg8NzRXM0yieA3qvCWpDozrq18MzZyPP1Eoj8ou/SNGZz9cvtUEgbXtKqZE 9aSHJVHNqiUD5eK7E2TLF6SrFYDDbnXAvt/A9+o2K+GhDxhW1mP/xdKPwQzbMfik D0kkrgFbDirok5KgYUpbwvDieuadO1yPmgQ0Em/NEorGDX8O53quENqXusU3Plcs +qModYcmiDYexG9/bPmGWd+l5ko7/jP6GZhabItXQKtjBc1uQyi6WRnS53Ltxkiw PwaaMupwKMUm1/xjt8ur6zf44M59GkGKtpJHRFtZq+iv0az8LldNrA5mzOI0ZuFY iDJJOA4ZxM3IdtT7zT9GOVwHma4iXqa5Lxj4OdDxCNvNOT6RKYIhn7bI7vS35dK4 YK7WRldcpIJD1oT6dslTP1UCSIYWEdoeeJt+H4ZKAcRA7f26MTk= =hg/p -----END PGP SIGNATURE----- --YiEDa0DAkWCtVeE4--