From nobody Sat Dec 21 13:53:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1707771086; cv=none; d=zohomail.com; s=zohoarc; b=Q/HWyX4g1B3VZwvvq17euz6qfaKRDY4va6/8ZgBfUPmC/ra/AiwiEQuva5dTuhvfyI3h3XGSpSC1Da1+2NPezorT7XUB8s53K5Mq3NJSQYrf+Mt/L5UgkmdCKessEm16b88TJg7h2qskyBgFZD+5jqhB4ixhs0hgio8Gv9yrMKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707771086; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UiPeJOx0ETDNIXAKYypll/nld8BVuCht7yp3n8HTsl4=; b=cvGNj8hisrVJ4X+Pf+yUYOxB9s3SZ57t1oCZaqPyTx5iyNSAZe5+hoznUt++kSZjLyhW/QZ6vCFbEk36krSDiPcqK05cpyiVkHWHiQnS9JcWwFZuC3XGSPOxHuOEuBK0guZ1/g6j9PaOxJzXRSWvYtCiSDbQzxtuNIo8OPt0Iw8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707771086830543.566447717235; Mon, 12 Feb 2024 12:51:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZdGE-0005jX-EF; Mon, 12 Feb 2024 15:50:42 -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 1rZdGB-0005jK-K8 for qemu-devel@nongnu.org; Mon, 12 Feb 2024 15:50:39 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZdG9-0003QG-Vv for qemu-devel@nongnu.org; Mon, 12 Feb 2024 15:50:39 -0500 Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CKbVS9019474; Mon, 12 Feb 2024 20:50:34 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w7the89dn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 20:50:34 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41CJfIMH016203; Mon, 12 Feb 2024 20:50:33 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mymb030-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 20:50:33 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41CKoT6v46793146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 20:50:31 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 644312004E; Mon, 12 Feb 2024 20:50:29 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 032F02004B; Mon, 12 Feb 2024 20:50:29 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.179.4.126]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Feb 2024 20:50:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=UiPeJOx0ETDNIXAKYypll/nld8BVuCht7yp3n8HTsl4=; b=QRK4tYgw5vLra5xPEfmX1rWuEGf5OztIS+jvWdjOg56uzk6EkBn9mm+YzIBdfUvw/pVT ZoEitzJXaO4yGZDW4qnU3rXDJQTbnUSBUQll8lFylylHev/smPl3IKjifus2oPz7q8Sh ApPu0YSDcg+JxkequI7O6xpkG+jY7gTpLmvyjN83VuTpQQ9FOavv/3fP6xxG/z6M3O2O Mn3h410TEYGZWi2aJEHn/TDLXrJ318QuTIDI81vZsBldPcTJ6ddcp0QIoYXD1/a/N2gx PKoBs3/W/pfnfQ1iICeZRBlUrT5846mfTInd2LqEg+MxffNK+N1Hzz1dYTzzEaZRjneb 7Q== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Richard Henderson Cc: qemu-devel@nongnu.org, Michael Tokarev , Ilya Leoshkevich Subject: [PATCH v2 1/2] linux-user: Map low priority rt signals Date: Mon, 12 Feb 2024 21:45:42 +0100 Message-ID: <20240212205022.242968-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212205022.242968-1-iii@linux.ibm.com> References: <20240212205022.242968-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3vipn1ZmSg8w-Lf-8TyqpMK9TiaLISW- X-Proofpoint-GUID: 3vipn1ZmSg8w-Lf-8TyqpMK9TiaLISW- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_16,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120161 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1707771088628100001 Content-Type: text/plain; charset="utf-8" Some applications want to use low priority realtime signals (e.g., SIGRTMAX). Currently QEMU cannot map all target realtime signals to host signals, and chooses to sacrifice the end of the target realtime signal range. Change this to the middle of that range, hoping that fewer applications will need it. Signed-off-by: Ilya Leoshkevich --- linux-user/signal.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index d3e62ab030f..a81533b563a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -511,13 +511,14 @@ static int core_dump_signal(int sig) =20 static void signal_table_init(void) { - int hsig, tsig, count; + int hsig, hsig_count, tsig, tsig_count, tsig_hole, tsig_hole_size, cou= nt; =20 /* - * Signals are supported starting from TARGET_SIGRTMIN and going up - * until we run out of host realtime signals. Glibc uses the lower 2 - * RT signals and (hopefully) nobody uses the upper ones. - * This is why SIGRTMIN (34) is generally greater than __SIGRTMIN (32). + * Signals are supported starting from TARGET_SIGRTMIN and up to + * TARGET_SIGRTMAX, potentially with a hole in the middle of this + * range, which, hopefully, nobody uses. Glibc uses the lower 2 RT + * signals; this is why SIGRTMIN (34) is generally greater than + * __SIGRTMIN (32). * To fix this properly we would need to do manual signal delivery * multiplexed over a single host signal. * Attempts for configure "missing" signals via sigaction will be @@ -536,9 +537,16 @@ static void signal_table_init(void) host_to_target_signal_table[SIGABRT] =3D 0; host_to_target_signal_table[hsig++] =3D TARGET_SIGABRT; =20 + hsig_count =3D SIGRTMAX - hsig + 1; + tsig_count =3D TARGET_NSIG - TARGET_SIGRTMIN + 1; + tsig_hole_size =3D tsig_count - MIN(hsig_count, tsig_count); + tsig_hole =3D TARGET_SIGRTMIN + (tsig_count - tsig_hole_size) / 2; for (tsig =3D TARGET_SIGRTMIN; hsig <=3D SIGRTMAX && tsig <=3D TARGET_NSIG; hsig++, tsig++) { + if (tsig =3D=3D tsig_hole) { + tsig +=3D tsig_hole_size; + } host_to_target_signal_table[hsig] =3D tsig; } =20 --=20 2.43.0 From nobody Sat Dec 21 13:53:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1707771095; cv=none; d=zohomail.com; s=zohoarc; b=UkW0SuyK7qd/sKLFCKm14ZHwXUBbh2qZLb+wZzgHsC/IanQbWPfa9n8m7Kq7kat2XgaAnq/A9jC4BqUZs/6yyShbrZWTWYny1Ym4NyA8USBvZ3QxyBrR4zAWr/7eAUbYcu69Bgv6mI9xQolRlwaMWTAhgpNkTiYRkO42F7WRJLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707771095; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=d2phFJJlULUL7w6epIsmhj+QJe2pXN6zPUlCSNfC8Z8=; b=GcyuZ+QqRVrHRAmKJ/4t49Bybh+9HYm9DkvfZpPruigNn25ot1giOBZYE+aI5TrjKvWOsAy1t214/DcCGWSjsClzQthACzKdcEXHNpfsc39KIGRMIW0vD/YSGPqhMCmTWu3r3Brh2cxmGJLsZ4HFoVmoFovMJe8Pr6Q0txX/E8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707771095667943.4106953445329; Mon, 12 Feb 2024 12:51:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZdGT-0005oJ-JR; Mon, 12 Feb 2024 15:50:57 -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 1rZdGK-0005kX-F7 for qemu-devel@nongnu.org; Mon, 12 Feb 2024 15:50:49 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZdG8-0003QH-KB for qemu-devel@nongnu.org; Mon, 12 Feb 2024 15:50:48 -0500 Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CKjskK010146; Mon, 12 Feb 2024 20:50:35 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w7tf8r8ab-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 20:50:35 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41CJeVj0024961; Mon, 12 Feb 2024 20:50:34 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mfp337b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Feb 2024 20:50:34 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41CKoU1A20054626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 20:50:32 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 507C32004F; Mon, 12 Feb 2024 20:50:30 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E40E720043; Mon, 12 Feb 2024 20:50:29 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.179.4.126]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 12 Feb 2024 20:50:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=d2phFJJlULUL7w6epIsmhj+QJe2pXN6zPUlCSNfC8Z8=; b=Nau3QGCHZGF0bDC/G2/fb9UR/84xDyECXDo5z1GZ2Kdz5UC2O24p5vIb2AVArhBkYxDt IviN43Q1TE0/iqUruQX88oEiENXhmPOzhYOb7SQLP5EIzfqOMllUESaP7M3P1SPmK/Ll NsYYCuUXQk2+9b6Bl8l9161kvdRbwLbbyri1lOSQkPUXXrCLcOttMmBr1QqbgI7LYM07 TMM4Q148Wlav+sb/4PEJvEQCJnTZLIYfKMy8Vonl51a0DuSn26arsQSAUfK0uRlAvFJL q25O6+d8gT390yE+OfxqvpfIWvuzL8eFVcAeMeC0OxghT+/xPF81ACLZnyHmWyE6i2BL NA== From: Ilya Leoshkevich To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Richard Henderson Cc: qemu-devel@nongnu.org, Michael Tokarev , Ilya Leoshkevich Subject: [PATCH v2 2/2] tests/tcg: Add SIGRTMIN/SIGRTMAX test Date: Mon, 12 Feb 2024 21:45:43 +0100 Message-ID: <20240212205022.242968-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212205022.242968-1-iii@linux.ibm.com> References: <20240212205022.242968-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: y8VjxJ4XrRLxheZ_r0w0idaz2Ch8uSq7 X-Proofpoint-ORIG-GUID: y8VjxJ4XrRLxheZ_r0w0idaz2Ch8uSq7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_16,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=735 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120161 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1707771096572100001 Content-Type: text/plain; charset="utf-8" Test the lowest and the highest real-time signals. Signed-off-by: Ilya Leoshkevich --- tests/tcg/multiarch/linux/linux-sigrtminmax.c | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/tcg/multiarch/linux/linux-sigrtminmax.c diff --git a/tests/tcg/multiarch/linux/linux-sigrtminmax.c b/tests/tcg/mult= iarch/linux/linux-sigrtminmax.c new file mode 100644 index 00000000000..773383a3fef --- /dev/null +++ b/tests/tcg/multiarch/linux/linux-sigrtminmax.c @@ -0,0 +1,41 @@ +/* + * Test the lowest and the highest real-time signals. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include +#include +#include + +static bool seen_sigrtmin, seen_sigrtmax; + +static void handle_signal(int sig) +{ + if (sig =3D=3D SIGRTMIN) { + seen_sigrtmin =3D true; + } else if (sig =3D=3D SIGRTMAX) { + seen_sigrtmax =3D true; + } else { + _exit(1); + } +} + +int main(void) +{ + struct sigaction act; + + memset(&act, 0, sizeof(act)); + act.sa_handler =3D handle_signal; + assert(sigaction(SIGRTMIN, &act, NULL) =3D=3D 0); + assert(sigaction(SIGRTMAX, &act, NULL) =3D=3D 0); + + assert(kill(getpid(), SIGRTMIN) =3D=3D 0); + assert(seen_sigrtmin); + assert(kill(getpid(), SIGRTMAX) =3D=3D 0); + assert(seen_sigrtmax); + + return EXIT_SUCCESS; +} --=20 2.43.0