From patchwork Thu Jan 11 12:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 45567 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bf2f:b0:199:de12:6fa6 with SMTP id gc47csp1667427pzb; Thu, 11 Jan 2024 04:53:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW428CStslHaPf66fxMYvpj5nQzEK4yY16npR5fG/o+mjDTBlK67zzvvhZbTfiG4tjG4Ga X-Received: by 2002:a17:907:6d07:b0:a23:58b1:11b8 with SMTP id sa7-20020a1709076d0700b00a2358b111b8mr563820ejc.185.1704977596949; Thu, 11 Jan 2024 04:53:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704977596; cv=none; d=google.com; s=arc-20160816; b=nx66Y3oEsOD9md8G6tnXFdYEHzZ37//lebjvZs57eRe3Xq+BmT6ar4c9biIPRqu1ke GRTPWsQTOnifgUtUWJxi/aR6N/O59dwWbqOLvKUzHirLwnKo7bg4Dh3KtyZumNbELiGY 9UjVM4v9SSQWSDHT6sYZQKDfAV8upT3TAVIuNTYMCOghAFUG7Qn4tCtvipxX1hrnGMnI Bqpmj/8ZqBJL/Sln1qi+DUjlsLfy17VXeBxwPvjxNdCcCKkctaMMpKA2UdXiQv4UCHrm 1gqiuDfrMvX977/m4WcPHKUJgLq2KnxZgna/PcaDjDqQc5laNe+R1wPPgV7IiOwn7Zmp 9AxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=SuqjgD/gTq2ekZBbJ1LWIKhaR9Q9O/yeZV7D4BAScVQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=m/YJ6yrLzHqKJSbMkDnTlMAuLFMS/11MB0J0VIN1rs23Vcwyd2udkaitxEzZBOXX/D tE/C67hcORZv55PGQv4rSW2xhlJ4r2Kzev1S0MX0PAaJkBYlW5iC+oMLW7PGigVk6Hbo x7mXZtTVW988UBayS0K/N+rtRbWFxMAzCFzOEhKbUO/gS8VhiW+C3KNIqNZY1aZ5AlSm PkddzQx3Bg+aakx2uD0lk7pqaw6zM8vwqHzepfewIdkMg0kWFAMDYCMRtuV2bHAUxJkY xVNeUcfumTohYLuYygsPWPsX4N/FGTpKrIyFYj/7P0nbEviqcDqYpDqS43JejajyNLqB 9Lsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=I4oUdgxT; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n26-20020a170906b31a00b00a2776d4d8aesi475653ejz.69.2024.01.11.04.53.16; Thu, 11 Jan 2024 04:53:16 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=I4oUdgxT; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D942068D024; Thu, 11 Jan 2024 14:53:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9E76468A943 for ; Thu, 11 Jan 2024 14:53:07 +0200 (EET) Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-50e7c6f0487so5655521e87.3 for ; Thu, 11 Jan 2024 04:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1704977587; x=1705582387; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=E++HoygGcqt/Xwn8hyBZA+xVomJSMCCd8RP3nINXRN4=; b=I4oUdgxTG47R+EJScYv4pSp46l2bmRQITxRtzhg9oYWFmahuHFJNawmuuXK9WBUQir 2YIo6sP/IC0mAZcCleMUAAzRnUHN7Q/l7GsasZyrUfH6KRXARnVf1yfCtwNEl5fueNy0 hIByzm89ms71rag5mc7fdXmk5ltaboRTSG9xMFn1a/mMpxqvqc+kVfPD/lkz0bfp3Ytn zRmnZTHQCTgGGaZtbpnF7r4VjjeP1QpcCE2TP6NamvpP8BpER+Zu98K7HVa+EjJZEOvc 7PcJNs+fmfS0pWVp5OPKrEQOgRTg0/qANSMqwM2bjskY+eJFBC95SE3h2lW7jOxUBYYJ 4EnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704977587; x=1705582387; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E++HoygGcqt/Xwn8hyBZA+xVomJSMCCd8RP3nINXRN4=; b=RG9RQhRzAjuXbBJYClk9q44kP7V2WuQnCVzbIeMCueR6ByAbg9SUI7LJrGMgsX/Jw7 UXfymUhs8TcjREhdlmRgnHafU1Aua1/EyflWvbYcPizO1ZvD4bNOZ0lwMW/RSI8uTCJr 6rPzhCcb9Iy+1iuysaXX73om1iXrAaU+FvJsLudpv4Ww0wYmCyjTw6R72Ads40UWGokq 8xu3BzY4Zz1E4MlzlEvmy6yK65422YaTrPnRgwQ33DTWt8R+4S4HrOGjWDbDVP0eG2pJ UxtXba12lUSJTlhYM7NVFiVPo47gG+VJfHcsXdWpFZOsj56vydhwFPRi9Aq00U2xnMtZ tlBw== X-Gm-Message-State: AOJu0YyT/O5edDniG3brFZeZyWu4WJB6hVP9O5aSgU54Ng6CGwyB1ip/ P0oG4F/alH+tcGrIHdg21MKXm23MBMHJE3xwMUI8Egxb+YgJ X-Received: by 2002:ac2:530f:0:b0:50e:bb1a:ebaf with SMTP id c15-20020ac2530f000000b0050ebb1aebafmr392856lfh.165.1704977586681; Thu, 11 Jan 2024 04:53:06 -0800 (PST) Received: from localhost (host-97-144.parnet.fi. [77.234.97.144]) by smtp.gmail.com with ESMTPSA id d2-20020ac24c82000000b0050eab0f6a59sm187388lfl.84.2024.01.11.04.53.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Jan 2024 04:53:06 -0800 (PST) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Thu, 11 Jan 2024 14:53:05 +0200 Message-Id: <20240111125306.77553-1-martin@martin.st> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] checkasm: Test whether direct cycle counter access works X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Zke3KeTMcQaE This should print a nicer error message than crashing due to an illegal instruction, if direct cycle counter access isn't allowed. This matches the dav1d checkasm commit 95a192549a448b70d9542e840c4e34b60d09b093. --- tests/checkasm/checkasm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 994d64e96b..9c5abb53dc 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -754,6 +754,14 @@ static int bench_init_kperf(void) static int bench_init_ffmpeg(void) { #ifdef AV_READ_TIME + if (!checkasm_save_context()) { + checkasm_set_signal_handler_state(1); + AV_READ_TIME(); + checkasm_set_signal_handler_state(0); + } else { + fprintf(stderr, "checkasm: unable to access cycle counter\n"); + return -1; + } printf("benchmarking with native FFmpeg timers\n"); return 0; #else @@ -927,7 +935,9 @@ int checkasm_bench_func(void) /* Indicate that the current test has failed */ void checkasm_fail_func(const char *msg, ...) { - if (state.current_func_ver->cpu && state.current_func_ver->ok) { + if (state.current_func_ver && state.current_func_ver->cpu && + state.current_func_ver->ok) + { va_list arg; print_cpu_name();