From nobody Sun Nov 24 08:19:24 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; arc=pass (i=1 dmarc=pass fromdomain=oracle.com); dmarc=fail(p=reject dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1725959400; cv=pass; d=zohomail.com; s=zohoarc; b=G4zYVA9jAqJgmUi6p6KGfPa+zRowBQaj7vjzLeIVxBRlMtnrMv0T30PlYUXl4wKfAoaaD1OYaCwi2QpMAt+x1gy1aSP0bKxKAIcgoQSF+GGMS7F4GKtRhhPiDPpUYmNw9kBSjOQMfYNOJGv3SYLLJ88E3uSQ9w24iKv9XhhrOcQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725959400; h=Content-Type: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=q0iQvauBKftLkn5wPQYkulRxXA4ngQtig5Bo3welgzw=; b=SIAVsIcJN3yyU3qK15KlnhwsTzWyYm8hK1zRu5kwerza8Dp407kLYSH8ccaxTvXqTdLT2ix/1mWZdrtpQcQC4mCkQDLjx1P1Yh1nKzWZp3Xt2Na8Ds0ZN39Z6B75uA/jFaDKEA9SD7Y4lWvkFGLzjJgUqN28tkz2O865QyOY/2I= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=oracle.com); dmarc=fail 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 1725959400600121.32785752467112; Tue, 10 Sep 2024 02:10:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snwsE-0001I8-IT; Tue, 10 Sep 2024 05:09:23 -0400 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 1snwrW-0007tn-2v for qemu-devel@nongnu.org; Tue, 10 Sep 2024 05:08:45 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1snwrS-0004J6-SB for qemu-devel@nongnu.org; Tue, 10 Sep 2024 05:08:36 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48A8tZZc008924 for ; Tue, 10 Sep 2024 09:08:30 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41geq9n07t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 10 Sep 2024 09:08:30 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48A8ao8R005070 for ; Tue, 10 Sep 2024 09:08:28 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41gd9898f7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 10 Sep 2024 09:08:28 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by CH3PR10MB7163.namprd10.prod.outlook.com (2603:10b6:610:127::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.16; Tue, 10 Sep 2024 09:08:01 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%5]) with mapi id 15.20.7939.010; Tue, 10 Sep 2024 09:08:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=q0iQvauBKftLkn5wPQYkulRxXA4ngQtig5Bo3welgzw=; b= LyiXyyVpqkW8uEAY+WsyiOALwnxc/YQBCHddAkXv/1hnoknSpB/EfEo/UKSFGymR gOh81K4/LlUUH8llyS/kNVG/R+ZpJaepgf+zofhDbAqVM+9k77dMMm3vpUatBbNc xS+kucp4u02SuIGWDSn5iRFBu00ox+lPmdJqg5z6dYjMIZ6S5nBJ/iKUmOihi2Tv qlnDK3xSZ8UEqtawLvS9JwXE3OZh3ZLaGCSGZkOvEKvw/8dT2z9/dWiNezQmmtw+ UmDoEJHq+cUUb0cOJGHlNn7Ndk8nywb/1ZaA8i3EQ0NCxHBzlGsOxGwyxHS27Dr2 zbef0cFtHixqCDE9lud3DA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KiVEkCkR5hKZlqiQU75FNykR8/8p7IA/ODBeC2o7nlVUNpTrSIMrdvJNRBkTAPkWsjaqa/+z3ovPgeWjwr8wsutXQLzoZfoMtjv+Gnsp7D6GGDHCjO6jM05RdNED2iF0TqOCyhi/CLp1FUAHS43+bawgziaQusGfyDqVNuCo+Jo2CXkp2FJEmHBA2RfAUEW2XzgeoLuHjTdYDjCzEt9OrzagR+c9NGGrEv2nFHowZ3NwxHdT6Tsm+ZQ6OUHh+jP0mZWWqczn0QsRzsQ7sgfMf7Xemjo0HK6lgxAsl2k3ZmfqenUQcj6edUEdMUbY/Tucx6USFYrMfi8gRA9MYr1HcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q0iQvauBKftLkn5wPQYkulRxXA4ngQtig5Bo3welgzw=; b=f0yg0j5CO/4NBemRyzkCAjWLJ/T5SCwEbZZ8+HZymtJ644cRLj6qE87uzqaKu5hqBuHAfA4ZE59ndcjaLHqX/RaldqUSXvwdGokGRW7HIKF/j9L8j3DGvwAVGAvaVuiTqxW31jF7dLwhoxPj1IQcUdAKmCQ1Ye78YUJUzNciE8mO0Aqleu0zf0da3NHlyZiWpyRvMsZcaYTtn5xvL4KcPeuuGHQSKuwJGfPFM1cey/tUlm2f1lJx40WyhTZ2OOXLj6gMLSLqGGNh6y5cybO72FwKgF8LAKfhFeJSRTIpgSAz/2jb05BDqt9GrB8/+Z7KeJlbjzAEV1FK7SmLPEYMBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q0iQvauBKftLkn5wPQYkulRxXA4ngQtig5Bo3welgzw=; b=mmuMckIFeXpcpDLW7Vunks/1pEfzkLfrcbGtHtYuj1l9oT1lbgxg0vyIiMSfFt16Tzip5Qhzx+gvua6JEvKYLdUpEhuO0DeuGVeDmHChMWpeiitGZ4WuXu64EZsvoQJs3X2AD9hBjz5nsoNNgCzKT27D7o2gr6beRiF0KX61sHs= From: =?UTF-8?q?=E2=80=9CWilliam=20Roche?= To: qemu-devel@nongnu.org Cc: william.roche@oracle.com, joao.m.martins@oracle.com Subject: [RFC 5/6] system/hugetlb_ras: Handle madvise SIGBUS signal on listener Date: Tue, 10 Sep 2024 09:07:46 +0000 Message-ID: <20240910090747.2741475-6-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240910090747.2741475-1-william.roche@oracle.com> References: <20240910090747.2741475-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR13CA0074.namprd13.prod.outlook.com (2603:10b6:a03:2c4::19) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|CH3PR10MB7163:EE_ X-MS-Office365-Filtering-Correlation-Id: dfc37579-713f-4073-a76e-08dcd178124f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4aC0e332yH5bykxnoYaZ0ENvAwfsePqd+xKkHQGDzlmc18xq4UJpplx/OT6i?= =?us-ascii?Q?ePfoiz94EtcWLOyMf1UtWCAFlZ/DO1HuAgEdwiN3CyIsHXoVWXj1xrn45U1g?= =?us-ascii?Q?yCue4V9xkaYOYbaq4OyhNqU7cTnSew1RuovmtxuGAAN3/Pd8xpVN9NgNmBmz?= =?us-ascii?Q?eL2T17jOu5R/S46D3spsPxlfwkPOH2aD5N21KG/utUXttzJ4p1cH3uWwmilR?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w3fKNhy1t22AtD51g2QISDq88vvzmaACj+?= =?us-ascii?Q?HLndXpOI9YskQtDciVqvDLq+eMaiEeaSBDkrZqypi8lVtm7OBsyZoOV5rNV8?= =?us-ascii?Q?1EXuIH+74CQN3wVCxhhTkfZAHFlelR5ONoegensYt4tglr/Qpyk3cBfUNV0x?= =?us-ascii?Q?Kw/d47/x3LqQvobr+56KDAUUZmTiQ1QqIAZTVfrWnve9cfZpI4yTMWylfZFL?= =?us-ascii?Q?O5AMRS/JQDITCQg/AprDURkZvnUCtMk0hdeUFzn22jihfA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR10MB7329.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(1800799024)(366016); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7Hfwcb35aQsBKMLbCaSlam7wKmfYbYhxA0jpeBMnUKvmJxQUOvtEJpZeP8em?= =?us-ascii?Q?oytZlN7uecC1micYyEzG4vAxek15jVGBzO1CNwD9o78snnquCbdxBaSH4KNm?= =?us-ascii?Q?M8HfaYkvXlee/JXgPfKZ79MqZRQJB8VUcHfAwoVzSmFG5GXNRWFetzXXnsDT?= =?us-ascii?Q?ZkTpcp40k5kjIZVxeOh65kalyelbuAIZkgHwv7/63dX9Q0T9ICH85VgZmqPU?= =?us-ascii?Q?fVHq8WQa972hBLc39Sxe+5Kj3XaH6mP5ngdwSUS/WgwNBsRm6z3kS5VYgdbu?= =?us-ascii?Q?aX9KTGrjf8FL2c3t1qYoIR8Rw7+1knezpjwUrojljJ5aPp9IxK9pWX9Pe8LM?= =?us-ascii?Q?I1XYm63n352mtWit5l2R3ERvRT6l/3qZiWsTOEj+wBWSX+Y/LOjWFHwBZxqZ?= =?us-ascii?Q?Yzs0DyeOZ7Bp9Unf6Yqw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=?us-ascii?Q?aKztdpwnZ4+LSpp1o6Txl6osTd15CZOlnoA+O6mYAd344OIwYN0/Lpsmp0HQ?= =?us-ascii?Q?+gs4hz1uMzsCJ+ZMxaKVpNp67Yy28xbNoRW3KjWdEgAg3hGCeqShHx7AGyvr?= =?us-ascii?Q?kOfZcie9V+ObAROLS0CoRzhD8wgfQ7eUuniZr7DDVKd/qmmciHCp9cDD4lb9?= =?us-ascii?Q?igha08+029myW4f9pGJmN3Vc4rcDJpx8YAuV541oMmjqciTmyzUQE+642ik6?= =?us-ascii?Q?NBqCol5Ar1cCBcWx8V8iT5ekcvZT9lpxYzO10MRZIyM16CrLOID/lHod2cwr?= =?us-ascii?Q?YQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2utK5CsBJETOaN3R5ooy1XT0TN4vPuug8E0UuwfbGkv9METXD8WLd5dZ9vF5kmSL/GNygsQNw4ZPVa4IvrOD4OR3tVcNvy5FREGd7CO/ppTwNja+NIIiht3NSfD7SpUMcFKL6ITPlGeqnEejqzMLJJoRpHRJIujKeXwqKb92rDWw+jRKImR3k5lHzVsAgryi9B/2DgXYlqJjC5QRoXFI17vsn783m8HsYfFgZE5DDLYCmbaf1NTS+ISM70dJ+p1ucPPiu0dUUh/u19Slc4LRIi6YYevH49YiL+TFgycBqJ8Chlo4RT6BZfuUYozXB+axsItEObJ8VebTu/iDpTKrKZXQ9uWeut3Yiz5x5Fo0B4Wjcsfh7/tSYSaLb6gFQ5ZjazOLM5cAYTjn0+b1qEFhjIhHfIJTco4KmLAHUPtmq/Kbl/309NE473PdNdbgkH/k1aY++3F6n7lExIa2PsXtYNBjCLayHIT0/qACNFboeLrJnnycQWdvbGanY5QzQruwkwui1FfMyqOQOEvzyRG6V39mUQdLMANJ9gW9UIW9yJS2wAmOBB5+V2xxt1gQc3+2LlPcZbFluhaXltNJmLeV3vWQZdUsuEGqJOKdAE879MU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfc37579-713f-4073-a76e-08dcd178124f X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2024 09:08:01.4935 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 23FVuucykByfGD2BhHoEqrfMgNlRcx7vnab+NIob8RInmdVd/CEPDh8sS1L24NoZCwSSumdrgtjADKjgnYsuZvoH1Ef0FN+nIh8vNaqbye0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7163 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-10_01,2024-09-09_02,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409100069 X-Proofpoint-ORIG-GUID: Dd-MVO7QG7l2cATmoJ_eteIDhZuHQn55 X-Proofpoint-GUID: Dd-MVO7QG7l2cATmoJ_eteIDhZuHQn55 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=205.220.165.32; envelope-from=william.roche@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) X-ZM-MESSAGEID: 1725959403086116600 Content-Type: text/plain; charset="utf-8" From: William Roche madvise MADV_HWPOISON can generate a SIGBUS when called, so the listener thread (the caller) needs to deal with this signal. The signal handler recognizes a thread specific variable allowing it to directly exit when generated from this thread. Signed-off-by: William Roche --- system/cpus.c | 9 +++++++++ system/hugetlbfs_ras.c | 43 ++++++++++++++++++++++++++++++++++++++++-- system/hugetlbfs_ras.h | 1 + 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/system/cpus.c b/system/cpus.c index 12e630f760..642055f729 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -47,6 +47,10 @@ #include "hw/hw.h" #include "trace.h" =20 +#ifdef CONFIG_HUGETLBFS_RAS +#include "system/hugetlbfs_ras.h" +#endif + #ifdef CONFIG_LINUX =20 #include @@ -374,6 +378,11 @@ static void sigbus_handler(int n, siginfo_t *siginfo, = void *ctx) sigbus_reraise(); } =20 +#ifdef CONFIG_HUGETLBFS_RAS + /* skip error on the listener thread - does not return in this case */ + hugetlbfs_ras_signal_from_listener(); +#endif + if (current_cpu) { /* Called asynchronously in VCPU thread. */ if (kvm_on_sigbus_vcpu(current_cpu, siginfo->si_code, diff --git a/system/hugetlbfs_ras.c b/system/hugetlbfs_ras.c index 2f7e550f56..90e399bbad 100644 --- a/system/hugetlbfs_ras.c +++ b/system/hugetlbfs_ras.c @@ -70,6 +70,8 @@ static QemuCond large_hwpoison_vm_running; static QemuMutex large_hwpoison_mtx; static QemuThread thread; static void *hugetlbfs_ras_listener(void *arg); +static pthread_key_t id_key; +static sigjmp_buf listener_jmp_buf; static int vm_running; static bool hugetlbfs_ras_initialized; static int _PAGE_SIZE =3D 4096; @@ -105,6 +107,10 @@ hugetlbfs_ras_init(void) qemu_cond_init(&large_hwpoison_vm_running); qemu_mutex_init(&large_hwpoison_mtx); =20 + if (pthread_key_create(&id_key, NULL) !=3D 0) { + warn_report("No support for hugetlbfs largepage errors - no id_key= "); + return -EIO; + } qemu_thread_create(&thread, "hugetlbfs_error", hugetlbfs_ras_listener, NULL, QEMU_THREAD_DETACHED); =20 @@ -288,6 +294,19 @@ hugetlbfs_ras_correct(void **paddr, size_t *psz, int c= ode) return (*paddr =3D=3D NULL ? false : true); } =20 +/* this madvise can generate a SIGBUS, use the jump buffer to deal with it= */ +static bool poison_location(void *addr, int size) +{ + if (sigsetjmp(listener_jmp_buf, 1) =3D=3D 0) { + if (madvise(addr, size, MADV_HWPOISON)) { + DPRINTF("poison injection failed: %s (addr:%p sz:%d)\n", + strerror(errno), addr, size); + return false; + } + } + return true; +} + /* * Sequentially read the valid data from the failed large page (shared) ba= ckend * file and copy that into our set of standard sized pages. @@ -321,7 +340,7 @@ static int take_valid_data_lpg(LargeHWPoisonPage *page,= const char **err) slot_num =3D page->page_size / ps; =20 if (!qemu_ram_is_shared(rb)) { /* we can't use the backend file */ - if (madvise(page->page_addr, page->page_size, MADV_HWPOISON) =3D= =3D 0) { + if (poison_location(page->page_addr, page->page_size)) { page->first_poison =3D page->page_addr; warn_report("Large memory error, unrecoverable section " "(unshared hugetlbfs): start:%p length: %ld", @@ -350,7 +369,7 @@ static int take_valid_data_lpg(LargeHWPoisonPage *page,= const char **err) retrieved +=3D count; } if (retrieved < ps) { /* consider this page as poisoned */ - if (madvise(page->page_addr + i * ps, ps, MADV_HWPOISON)) { + if (!poison_location(page->page_addr + i * ps, ps)) { if (err) { *err =3D "poison injection failed"; } @@ -402,6 +421,19 @@ void hugetlbfs_ras_empty(void) qemu_mutex_unlock(&large_hwpoison_mtx); } =20 +/* + * Check if the signal is taken from the listener thread, + * in this thread we don't return as we jump after the madvise call. + */ +void +hugetlbfs_ras_signal_from_listener(void) +{ + /* check if we take the SIGBUS in the listener */ + if (pthread_getspecific(id_key) !=3D NULL) { + siglongjmp(listener_jmp_buf, 1); + } +} + /* * Deal with the given page, initializing its data. */ @@ -498,6 +530,13 @@ hugetlbfs_ras_listener(void *arg) LargeHWPoisonPage *page; int new; const char *err; + sigset_t set; + + pthread_setspecific(id_key, (void *)1); + /* unblock SIGBUS */ + sigemptyset(&set); + sigaddset(&set, SIGBUS); + pthread_sigmask(SIG_UNBLOCK, &set, NULL); =20 /* monitor any newly submitted element in the list */ qemu_mutex_lock(&large_hwpoison_mtx); diff --git a/system/hugetlbfs_ras.h b/system/hugetlbfs_ras.h index 324228bda3..9c2a6e49a1 100644 --- a/system/hugetlbfs_ras.h +++ b/system/hugetlbfs_ras.h @@ -1,3 +1,4 @@ bool hugetlbfs_ras_use(void); bool hugetlbfs_ras_correct(void **paddr, size_t *psz, int code); void hugetlbfs_ras_empty(void); +void hugetlbfs_ras_signal_from_listener(void); --=20 2.43.5