From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC8F1C6379F for ; Mon, 13 Feb 2023 23:55:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRifN-0000H8-Je; Mon, 13 Feb 2023 18:55:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRifM-0000Gz-Nr for qemu-devel@nongnu.org; Mon, 13 Feb 2023 18:55:24 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRifK-0003Wt-Jw for qemu-devel@nongnu.org; Mon, 13 Feb 2023 18:55:24 -0500 Received: by mail-ed1-x52f.google.com with SMTP id w3so8176215edc.2 for ; Mon, 13 Feb 2023 15:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QoVB6FfBDeAVhl+wS/GzSpO6aYVrICp4Uu5CXdw5R0Q=; b=Pi2pO/TMan8j4c5afN91eEPwoANRE7lLPv/uWzsepcVnAGOxGW/7AF95yIaHXEiV29 XYH31nPtDz92l5PsWOW0UjTojEIishZf194UMRkxIDIytbAdCzutUtRPxeTJmShqWfS5 KGhdpj+nw5fE0qPJxH4qeZLJ7DRusmDPPol0x/EujMrKDyPR4Py2muTJsl8JDn057Oje VC8SYVtzl4hHuGe/z6zbHOfUlTRuB0CSEk1igch8qI3eVID8QN8V+KlE8NUEcz8eOp2+ Be7gabwMTt2q9dALr1kteUKYG0W2lJ2NBzsIChXgkDYb53u1+i7tLxL5Vy87RK8RzsBC oFzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QoVB6FfBDeAVhl+wS/GzSpO6aYVrICp4Uu5CXdw5R0Q=; b=Wf4F6eRslU6YM8ckdRIBOe7L4XNzudlGS6CJw9pYcRbx9zW9+XP/TNLbDEQKfn9yrP xvLydBPS3X93jzxNAtTHQxFccfVKZnqpigT9UY2aeBySgthTPc/f/0RkgJXreaFbN0eg I6cQvLwGGWcAJT1VebqPrk5hhd+fhnZjX31GaRquJCANfEObBkHJc7uMZTB7dHWuucvk RaQ/c7oVgLcSqNyPSjABWQXlSOaI3IGOPkiCa0WDl+FaNxCKEP/uT+uG0CfV42UZKJGl 4rPbOch1pfmWFmNCLW2hX9vRtjm04V6A7vANcYmfTXWBp3r1rrXFcOZFwu5jUis4PaDJ dwUQ== X-Gm-Message-State: AO0yUKUc4wXq7NhcQ2yGQfJ7+DBw5YFJ0aBLnS0HfC89eCJZC0WAD0fF ILlz/mVjkvkynmi8VCqvqQDhRX3EYHF5ukvLHbQ7Og== X-Google-Smtp-Source: AK7set8ZSABpDCL9iYFFvJ08FDO3vcriFXoV/7GpQi3Xm831ZINUAqWzSkxarYRYHm0U1JzdAPTHxdAM1/5EDCvGcog= X-Received: by 2002:a50:cdcf:0:b0:4ac:b4b3:b788 with SMTP id h15-20020a50cdcf000000b004acb4b3b788mr247668edj.0.1676332520053; Mon, 13 Feb 2023 15:55:20 -0800 (PST) MIME-Version: 1.0 References: <20230210231829.39476-1-imp@bsdimp.com> <20230210231829.39476-10-imp@bsdimp.com> <714e259e-06e0-2f34-ad6e-a6316625d1c2@linaro.org> In-Reply-To: <714e259e-06e0-2f34-ad6e-a6316625d1c2@linaro.org> From: Warner Losh Date: Mon, 13 Feb 2023 16:55:09 -0700 Message-ID: Subject: Re: [PATCH 9/9] bsd-user: Add -strict To: Richard Henderson Cc: qemu-devel@nongnu.org, Thomas Huth , Kyle Evans , f4bug@amsat.org, =?UTF-8?B?QWxleCBCZW5uw6ll?= , Paolo Bonzini Content-Type: multipart/alternative; boundary="0000000000006236c005f49d9435" Received-SPF: none client-ip=2a00:1450:4864:20::52f; envelope-from=wlosh@bsdimp.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --0000000000006236c005f49d9435 Content-Type: text/plain; charset="UTF-8" On Sat, Feb 11, 2023 at 4:19 PM Richard Henderson < richard.henderson@linaro.org> wrote: > On 2/10/23 13:18, Warner Losh wrote: > > Most of the time, it's useful to make our best effort, but sometimes we > > want to know right away when we don't implement something. First place > > we use it is for unknown syscalls. > > > > Signed-off-by: Warner Losh > > --- > > bsd-user/freebsd/os-syscall.c | 4 ++++ > > bsd-user/main.c | 5 ++++- > > bsd-user/qemu.h | 1 + > > 3 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/bsd-user/freebsd/os-syscall.c > b/bsd-user/freebsd/os-syscall.c > > index 179a20c304b..e2b26ecb8dd 100644 > > --- a/bsd-user/freebsd/os-syscall.c > > +++ b/bsd-user/freebsd/os-syscall.c > > @@ -508,6 +508,10 @@ static abi_long freebsd_syscall(void *cpu_env, int > num, abi_long arg1, > > > > default: > > qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); > > + if (bsd_user_strict) { > > + printf("Unimplemented system call %d\n", num); > > + abort(); > > + } > > I don't like the raw printf, even if you did write to stderr. > Perhaps just the abort, letting the error message be handled by qemu_log? > > > @@ -396,6 +397,8 @@ int main(int argc, char **argv) > > trace_opt_parse(optarg); > > } else if (!strcmp(r, "0")) { > > argv0 = argv[optind++]; > > + } else if (!strcmp(r, "strict")) { > > + bsd_user_strict = true; > > Perhaps force LOG_UNIMP? Without -D, you'll get the qemu_log above to > stderr. > Given the number of other changes in the other bits, I'm going to defer this feedback until round 3, since the number of changes I've made for round 2 means there will almost certainly result in a round 3... Warner --0000000000006236c005f49d9435 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Feb 11, 2023 at 4:19 PM Richa= rd Henderson <richard.he= nderson@linaro.org> wrote:
On 2/10/23 13:18, Warner Losh wrote:
> Most of the time, it's useful to make our best effort, but sometim= es we
> want to know right away when we don't implement something. First p= lace
> we use it is for unknown syscalls.
>
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
>=C2=A0 =C2=A0bsd-user/freebsd/os-syscall.c | 4 ++++
>=C2=A0 =C2=A0bsd-user/main.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 5 ++++-
>=C2=A0 =C2=A0bsd-user/qemu.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 1 +
>=C2=A0 =C2=A03 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-sysca= ll.c
> index 179a20c304b..e2b26ecb8dd 100644
> --- a/bsd-user/freebsd/os-syscall.c
> +++ b/bsd-user/freebsd/os-syscall.c
> @@ -508,6 +508,10 @@ static abi_long freebsd_syscall(void *cpu_env, in= t num, abi_long arg1,
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 =C2=A0default:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_log_mask(LOG_UNIMP, "= ;Unsupported syscall: %d\n", num);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (bsd_user_strict) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("Unimplemented = system call %d\n", num);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 abort();
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

I don't like the raw printf, even if you did write to stderr.
Perhaps just the abort, letting the error message be handled by qemu_log?
> @@ -396,6 +397,8 @@ int main(int argc, char **argv)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trace_opt_parse(= optarg);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (!strcmp(r, "0&= quot;)) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0argv0 =3D argv[o= ptind++];
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (!strcmp(r, "strict")= ) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bsd_user_strict =3D true;
Perhaps force LOG_UNIMP?=C2=A0 Without -D, you'll get the qemu_log abov= e to stderr.

Given the number of other = changes in the other bits, I'm going to defer this feedback until round= 3, since
the number of changes I've made for round 2 means t= here will=C2=A0 almost certainly result in a round 3...

Warner
--0000000000006236c005f49d9435--