Message ID | 20240222145819.96646-1-john.g.garry@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-76733-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp306201dyb; Thu, 22 Feb 2024 06:58:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXMw3iv0+OFqQ3PMbXaJ/eKBanAby5qM0JIMpK0iF520C4kYx/YjduASoX7I/hYSbU8/Q5HOLdlP/8jIi+X0LTQHHzxYw== X-Google-Smtp-Source: AGHT+IFO3Cc5Q+AttfZFrhBTppTtlkm+oKxas3V4QDWgPbNZOnWBLPOQoniLuXg8an9rjbbKFjJk X-Received: by 2002:a17:906:280c:b0:a3d:78a:bffa with SMTP id r12-20020a170906280c00b00a3d078abffamr19085469ejc.0.1708613935146; Thu, 22 Feb 2024 06:58:55 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s14-20020a170906168e00b00a3ee141ef10si2864085ejd.136.2024.02.22.06.58.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76733-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=lvZPHHGS; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZZ4X2uYX; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-76733-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76733-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8EDE81F25C8E for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 14:58:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAED114A08F; Thu, 22 Feb 2024 14:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lvZPHHGS"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ZZ4X2uYX" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82BA917BAA for <linux-kernel@vger.kernel.org>; Thu, 22 Feb 2024 14:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708613917; cv=fail; b=R5ILwzUnxJKjYQRlov7PYzDEXiedqIPmPvo8+XBlH1RvS/PT1wCddCUZZKr4FHr/6D/PSH5TnvKsyzCxk71vkgkvVc2vSMMPPBFrNpoN4ySSXjgNrkbVf2c/2qVaECzNQ1Y3ynKNxTsIhNfUvYYVfa97To8Nyla2lP2NuVs3jy0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708613917; c=relaxed/simple; bh=cQ50wK6D/KIoZam/nLzO3B2Iz6SRq1bsn1KT5zQQPRw=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=MYDjmbS+jblR2nAJsw1Cd12xp1lYmQl6lJUjXdDqFsGzk6+3zR/Y/rqDLZN2LPR6G8/Ca+swl0hXj4djmR8G7WxVIvD9+WKuckNwcEEsOiXYtDggTVzFRlb5NhSvlttEoFoHxSTvEDHG/Eo4Bt3PwKpXhb3YR4iRlHUeX+n+9Fc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=lvZPHHGS; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ZZ4X2uYX; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MBe2v2018113; Thu, 22 Feb 2024 14:58:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=ub0Mpv5cHB6P5XhXuBcDWOOKEggKcKWL4jvtdH/6Fcc=; b=lvZPHHGSIybCXDpOuwXj8rNu+iMQSqxM441Z0jvj4GUPsOX0frGx6m7taJe5ctw34Pnq 7fPScBJziERTBuHObO7SbG65H6o2RXRBeqPL82sfPhyWlePv/YB4j8VOes92wMj79NS/ yBzzpEP7FrvZAziRzsauUzUbnogrxaypx9F++AVatHRNlI/2iHmFaQlZ8Cecs8ddKzZt MU9oj9FD/RJlc/VpMHqO/hOYxJjVYXFqBofF+LmMscgVuqC+MMDx2N3RG8kwHHYoRPk8 XyPijKSBS7UFDBMNgRZy8zSWLyzKL709OAH4Bwd4yKD4SYd14kGYjl/8aK1iLcIk1KB5 jA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakqccwtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 14:58:29 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MEoj7v024858; Thu, 22 Feb 2024 14:58:27 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8arrva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 14:58:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H4CZ32fBxw9m/FTdRwQ5hiS+htqIKNSIt55WzqdRqTcEA1y+H0xxq8/V6E6ZxwIQS5G7/XqSIODhy5rSTxDt7cZ0cw327qpailJlr4P1oRuVUdo29yVG4Z8tBthlyMqCQ5shURQSqBCjXEk+p/CPrcXM5NMWVlrk/tXp2sFqxdV2bMMPWcujJK6wQFzv1NXuxqEN+AsqklqBbxkDkZ+Q9Y0Sz8o1r5kiAHidgzYHSadhrYETJVDjXt0QX3Zau8EniHFjzMyCyZ9SGdVK+RFJ8drtMkA2sUoBYqGpmylxW0x63gfznTPerbBY9eNcUq4blkih3WaExZG8U8zvt6qvgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ub0Mpv5cHB6P5XhXuBcDWOOKEggKcKWL4jvtdH/6Fcc=; b=OVvrkpGC8hHHwPgWBidt8fqPMbJ+SgAcaxi5VpedESBfVfE/2WpUcUDWSltfW2/BjcMf53fN0wF0VBbEyghZK4MmdiGuE/81+Vzdmvoi1mak7bwTXgqVdVOCUKc2+9ovJDNfDInE1pzfNipKyxYmUmLOxKmVBVm1PCvBgAk2ubxd0nGQ/dH9OUuTDxqWbImftgy++zyD65E3jVJzoC/TuaB+EMNhEDVUXq2lGciIglC9/sHg3BdJ+OQwVEzHB7u33wnWueYSb9pxzZ1XqXNZ1Ns3rCIAWgwSOrbdqPA1Gqfmpoz4+w6oYb8ywnRAn6eOUeyJUqIHyTdFaUe1mtSYng== 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=ub0Mpv5cHB6P5XhXuBcDWOOKEggKcKWL4jvtdH/6Fcc=; b=ZZ4X2uYX+7nfve89nNrFIe3eUWYe8X2Vb/GSWXCLbX051wGHjTkua4w6AgawKcEjOC/8kI03V8ymkdSvNHWgmBk7dGs/2g+Ce8sltnUyOvX6f6Opw4gxW6hdZLp2NtAkMADFgHtLRidYWF/syQ3QKMy6Ep288NtwpPeh6uX5PGQ= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SJ2PR10MB7110.namprd10.prod.outlook.com (2603:10b6:a03:4cd::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.22; Thu, 22 Feb 2024 14:58:25 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::56f9:2210:db18:61c4]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::56f9:2210:db18:61c4%4]) with mapi id 15.20.7316.018; Thu, 22 Feb 2024 14:58:25 +0000 From: John Garry <john.g.garry@oracle.com> To: mcgrof@kernel.org, russ.weight@linux.dev, gregkh@linuxfoundation.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, masahiroy@kernel.org, John Garry <john.g.garry@oracle.com> Subject: [PATCH] firmware_loader: Use init_utsname()->release Date: Thu, 22 Feb 2024 14:58:19 +0000 Message-Id: <20240222145819.96646-1-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BL1PR13CA0361.namprd13.prod.outlook.com (2603:10b6:208:2c0::6) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SJ2PR10MB7110:EE_ X-MS-Office365-Filtering-Correlation-Id: e28f635e-d8c9-4c2e-dc5f-08dc33b6b878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yVI8Lz9Axc4IMYnwBVSpBW6wadRWAuE+8O+wOmTsxzeI2kuQkx7ZiQvUQkyb+ij9eTfcglR9W0LGNdwkT8fotM3nVyo11iPVGqaYM7iB5AW44RtvqAUMJiAEQCWojPti0hU7Q9EPE0DcoXBqcWavqZtE5+aca/+u4goqVfPWgiOAmCZabakTnFNUOnkZ9xne/EB9TOkUxjk7hXxC4Bj+tGcLOrLYObCOIuY/YQeDq9c0apM+HcF0BGHAmD4bfS33xkUA6MvRUpzjA7dHNO5nVov3//VlF87DswGNaaiODa4RhsE2I3hDPjgqPRezXPxQZgiZv/aWeyNX998geZdoe8AnwrAQeNjNPmkqhLqsnDQvm1G88lqXkb9d7q+ZujloX0sce0c5p/wxtQWBEulJMEZTBuu2csHHBQVKqUqEHA+VT/0rQBYpKlrt+HjhrMvejX0hf4OFsqN1WvZTdeUwJwwk7xcfveWQxPrPivp3ujeE8OA2ghlk3Yn2G7/f503kIPcJNmnkE1VoVy8pY8EYpw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lZjO/Ev8/L412+UXNLk2HNAv6LGSIroLwXokZTKv1fp83B5y5YaaHQ159aq+LOXLcOT0EWCjDfNu2FvHs2fiaLzmsEp3DAWxkVB7VD/8l/i/Ty7oV/4AaKFCsLDy1SMLrPsqKz/VE+WR4ZgOknLhOJ8RHivR7575riv2FiIddLpuJCRqKAtZYMK3jTWBnSA62G6D/ykejY3vBEw63uv9Q4LUJd7Oepf1jqpjBjHiKgasCKS6B5isj/7IrSBLena3SONLoi7hRjHfNoQtSU2KZPyCRttH9ZiHOZifGQD2Aq016mknj54e+2ckyW4w4SXz13FtSg/OO3oAyFPmHMnh3vRMRgINr7bJwTYqhZoXiKrBsg1cKDWtaHefFtQVtu/7NOGjhZvW2XEhi9odgnUv34YmDimok/z7z7eeM3P1YDkIij7i6bdtzWXD9S36ONcnDrW356P0LhlmYptlLCSRkLWDk8axDFcPktYrfAYl9V5tBfDfTLalBX53FmL0D3mQC0BNgNG1d/wk6kjgJQXEvt5HtJBzcan225CGam1wYwL3dik1WExeOsktA544NNwcs/5gVgVMlfjMNrcC018URLWkZ8LFg7z6RKHn1a9dGG6R+h0qdfGUeEUiEl7Y3955bnXfxVbFKc2b3KE3qUwZuyAX1Yj19kOQ6PS3OLJq+crNTjDvr4yVo2MRTTOn3weW/+FO7/6fKKRx1p5ytjTYY0hkHShz0VMKrLZRg9bReUH1JIN7bAp3KDVdo84IZCg9trsAab6VD3hFkbVvxd+7fDg5n/X3JWmVG7U+YAnSrrE0wWkYUAaoqCl7WwyDSxFbLeaBXpKcu8dznp1HqKjkpGeIoDYlBmpuQYAXvSSqSd8EielkJj6Y6WjJ7X65mHwry82AG7RR/et2Rj8uP5eK3lddSDvzVqXnmJERuLdwdHH8GEs8ff9UZ5rgFVFeZ0xrpFOFwq+xPw/0cd+DDsugT5Z1brICJ9UdZWXTn0EUERz6r2cpkdLLwOb3UeuF2kIhcb4QSNGsrHx6dDNvBa6IeDxW++hocT6gveKMCn5xgdzzEwaS5k6rW3HG127buGPjL26y6JlQ2GhtgvCpFpVd8N6jrPMUQ8b3OAJH4RzvtDro0LZK1QPyDhQUineh/oqF4Eu3JLTuqj2+c78lJB/yGMTzyiIkjDA3gU7n5701CAytDQakHhN2vHAKB028ghpgfDKpeIQP336XyBAUYAcX06vY9y9R/iMz7sewfNdwuP/VQz5F7OxuLjRf3HWyrDrijfimP14GokDE9mMacF/CJU3Q0o0mQCWHgBiOmNbp8Ml3D1zAPC7ElLkKgDiTboT/SQF6uK5+r5tToKNnyfy71AW7b9hOivH/cB1ueodal97kLg9CWHu3rqyrZqP40p//TzcAdB+Uo+Ui6PCjkSvx1h2sCyRttHdwAzzN8mS2c+ISWx1/nYaxf4tsYj6tHz89XUWL/Jj9bJsV1PAkWw7ZgGUltiEsJNz2qBPt8qvvjq8leLXE4lOaHOP0OrZcSMxnNgFvBAtqXVc9Bdr2PPBCOvRBXot7l/m1CvFVhDSk94wGDWu008tDq9scoQEVDHPJ1HP8DnKyVPxe4JaAAwj3ag== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ilEmMoiIhwGJ/L4DTkNMtqu9Sj/VmyjtuSA2HPWCp4WhaMqUlIEKgKiitjcZWgXhI9v4dMSJ+PBt4f2IkCqyXGSra/ZX8vSc5pOONhKnsjPM6X+Qv8Jus+UQ9GUwjBTHZXkdNLlYMYF3+zM6MJ/BnVJRIZQj45gFVwpd+9RtH8oHEegglb7iil/KRB//2IWrYdD9zxv+bhRgbqDwoDuFUl05TXdpgLcsKLgiQltWjrPfwKVb1jaKAFVfIq8LHB7HRCjYzR84Za+JrESPMkygXcWPLrYdTM+Z6LnFOvzwcHA8ewxW+PafRtzYBJscBp7OpWoJJI4i359sbdxE1WbMrHuzTp45uesS7VDHofaYePx2/7e/voMw4EU8wXD19lAcWcUOcEhuEFOAsDfqLXeT8eOoWzgid8tkdtM1dHN9tsFhmwWw4A+cyUtvTbLrxlRAzP3ySH8ATpnbNUbGwKf0bPms3Yg4LB4/PGwxcg8+T760Dvf6DmDraSaTwOYFeUGxVPmylxCvVwhx+qCAgS9w+6CzaRk5Q5EnwhlsIf7lW8YFKlOfxERNmyBUJHFx33AAfAbCqBvZkEKtvUzWSjzbs0WK9Tb6KzyXpbbiZZx3fBQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e28f635e-d8c9-4c2e-dc5f-08dc33b6b878 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 14:58:25.2767 (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: +G8dBjwoP8PJiUuL4ZRUvjHxwUs6Yvp5TEG6gQOMhHBxEnmBq9sg7wKQ/bDZJjBVIUNaBjYvp2CPanQzRYNDnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7110 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-22_11,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220119 X-Proofpoint-GUID: mxKM1sxXNxJlIbV_vXYwRMunLl_GABYc X-Proofpoint-ORIG-GUID: mxKM1sxXNxJlIbV_vXYwRMunLl_GABYc X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791611565786519123 X-GMAIL-MSGID: 1791611565786519123 |
Series |
firmware_loader: Use init_utsname()->release
|
|
Commit Message
John Garry
Feb. 22, 2024, 2:58 p.m. UTC
Instead of using UTS_RELEASE, use init_utsname()->release, which means
that we don't need to rebuild the code just for the git head commit
changing.
Since UTS_RELEASE is used for fw_path[] and this points to const data,
append init_utsname()->release dynamically to an intermediate string.
The check for appending uts release is if the string in fw_path[] ends
in '/'. Since fw_path[] may include a path from the kernel command line
in fw_path_para, and it would be valid for this string to end in '/',
check for fw_path_para when appending uts release.
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
Note: As mentioned by Masahiro in [0], when CONFIG_MODVERSIONS=y it
could be possible for a driver to be built as a module with a different
kernel baseline and so use a different UTS_RELEASE from the baseline. So
now using init_utsname()->release could lead to a change in behaviour
in this driver. However, considering the nature of this driver and how it
would not make sense to build as module against a different tree, this
change should be ok.
[0] https://lore.kernel.org/lkml/CAK7LNAQ_r5yUjNpOppLkDBQ12sDxBYQTvRZGn1ng8D1POfZr_A@mail.gmail.com/
Comments
On Thu, Feb 22, 2024 at 02:58:19PM +0000, John Garry wrote: > Instead of using UTS_RELEASE, use init_utsname()->release, which means > that we don't need to rebuild the code just for the git head commit > changing. > > Since UTS_RELEASE is used for fw_path[] and this points to const data, > append init_utsname()->release dynamically to an intermediate string. > > The check for appending uts release is if the string in fw_path[] ends > in '/'. Since fw_path[] may include a path from the kernel command line > in fw_path_para, and it would be valid for this string to end in '/', > check for fw_path_para when appending uts release. > > Signed-off-by: John Garry <john.g.garry@oracle.com> > --- > Note: As mentioned by Masahiro in [0], when CONFIG_MODVERSIONS=y it > could be possible for a driver to be built as a module with a different > kernel baseline and so use a different UTS_RELEASE from the baseline. So > now using init_utsname()->release could lead to a change in behaviour > in this driver. However, considering the nature of this driver and how it > would not make sense to build as module against a different tree, this would not make sense to build it as an external module against against a different tree, so this change should not have any effect to users. > change should be ok. > > [0] https://lore.kernel.org/lkml/CAK7LNAQ_r5yUjNpOppLkDBQ12sDxBYQTvRZGn1ng8D1POfZr_A@mail.gmail.com/ Thanks for doing this, could you send a v2 with the "Note:" removed but instead include that blurb as part of the commit log as it is important information to retain. Could you also test the selftests to ensure nothing is broken ? /tools/testing/selftests/firmware/fw_run_tests.sh Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Luis
>> --- >> Note: As mentioned by Masahiro in [0], when CONFIG_MODVERSIONS=y it >> could be possible for a driver to be built as a module with a different >> kernel baseline and so use a different UTS_RELEASE from the baseline. So >> now using init_utsname()->release could lead to a change in behaviour >> in this driver. However, considering the nature of this driver and how it >> would not make sense to build as module against a different tree, this > > would not make sense to build it as an external module against against a > different tree, so this change should not have any effect to users. > ok >> change should be ok. >> >> [0] https://urldefense.com/v3/__https://lore.kernel.org/lkml/CAK7LNAQ_r5yUjNpOppLkDBQ12sDxBYQTvRZGn1ng8D1POfZr_A@mail.gmail.com/__;!!ACWV5N9M2RV99hQ!KxnFzsitgB8e0kDndt3nYwqw0FcAPKzJjuRl9BzwLQ9dbAtqK_SZOkhHw9ssT2PobYVkh8UU7WryWKwGXg$ > > Thanks for doing this, could you send a v2 with the "Note:" removed but > instead include that blurb as part of the commit log as it is important > information to retain. ok > > Could you also test the selftests to ensure nothing is broken ? > > ./tools/testing/selftests/firmware/fw_run_tests.sh I am running this now, but it does not seem stable on a v6.8-rc5 baseline. I am seeing hangs. Are there any known issues? This one passed, it seems to me: https://pastebin.com/ZySPmH9h But then on another run I see a hang at: ... Testing with the file missing... Batched request_firmware() nofile try #1: OK Batched request_firmware() nofile try #2: OK Batched request_firmware() nofile try #3: OK Batched request_firmware() nofile try #4: OK Batched request_firmware() nofile try #5: OK Batched request_firmware_into_buf() nofile try #1: OK Batched request_firmware_into_buf() nofile try #2: OK Batched request_firmware_into_buf() nofile try #3: OK Batched request_firmware_into_buf() nofile try #4: OK Batched request_firmware_into_buf() nofile try #5: OK Batched request_firmware_direct() nofile try #1: OK Batched request_firmware_direct() nofile try #2: OK Batched request_firmware_direct() nofile try #3: OK Batched request_firmware_direct() nofile try #4: OK Batched request_firmware_direct() nofile try #5: OK Batched request_firmware_nowait(uevent=true) nofile try #1: OK Batched request_firmware_nowait(uevent=true) nofile try #2: OK Batched request_firmware_nowait(uevent=true) nofile try #3: OK Batched request_firmware_nowait(uevent=true) nofile try #4: OK Batched request_firmware_nowait(uevent=true) nofile try #5: OK Batched request_firmware_nowait(uevent=false) nofile try #1: OK Batched request_firmware_nowait(uevent=false) nofile try #2: OK Batched request_firmware_nowait(uevent=false) nofile try #3: OK Batched request_firmware_nowait(uevent=false) nofile try #4: And kernel log: [ 385.105004] test_firmware: #3: failed to async load firmware [ 385.181221] test_firmware: #0: failed to async load firmware [ 385.252231] test_firmware: #1: failed to async load firmware [ 385.323307] test_firmware: #2: failed to async load firmware [ 385.397444] test_firmware: #3: failed to async load firmware [ 644.462125] INFO: task fw_filesystem.s:5466 blocked for more than 120 seconds. [ 644.548803] Not tainted 6.8.0-rc5-g7e58e46976f2 #32 [ 644.613581] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 765.294106] INFO: task fw_filesystem.s:5466 blocked for more than 241 seconds. [ 765.380805] Not tainted 6.8.0-rc5-g7e58e46976f2 #32 [ 765.445610] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 886.126154] INFO: task fw_filesystem.s:5466 blocked for more than 362 seconds. [ 886.212883] Not tainted 6.8.0-rc5-g7e58e46976f2 #32 [ 886.277695] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. FWIW, with my patch we get same output for "passing" run upto another hang. Thanks, John >
> > FWIW, with my patch we get same output for "passing" run upto another hang. I will note that it has "passed" with this patch, so I sent the updated v2. Please let me know any testing or further debug that is required for that intermittent hang. Cheers, John
On Fri, Feb 23, 2024 at 02:29:19PM +0000, John Garry wrote: > > Could you also test the selftests to ensure nothing is broken ? > > > > ./tools/testing/selftests/firmware/fw_run_tests.sh > > I am running this now, but it does not seem stable on a v6.8-rc5 baseline. I > am seeing hangs. Are there any known issues? I tested next-20240108 and so no issues. Lemme upgrade. Note you also need /lib/udev/rules.d/50-firmware.rules removed if you have it. Luis
On Mon, Feb 26, 2024 at 08:34:11AM -0800, Luis Chamberlain wrote: > On Fri, Feb 23, 2024 at 02:29:19PM +0000, John Garry wrote: > > > Could you also test the selftests to ensure nothing is broken ? > > > > > > ./tools/testing/selftests/firmware/fw_run_tests.sh > > > > I am running this now, but it does not seem stable on a v6.8-rc5 baseline. I > > am seeing hangs. Are there any known issues? > > I tested next-20240108 and so no issues. > > Lemme upgrade. > > Note you also need /lib/udev/rules.d/50-firmware.rules removed if > you have it. I don't see any hung tasks on next-20240226. Perhaps its with your config that it is triggered. Luis
On 26/02/2024 17:10, Luis Chamberlain wrote: >>> I am running this now, but it does not seem stable on a v6.8-rc5 baseline. I >>> am seeing hangs. Are there any known issues? >> I tested next-20240108 and so no issues. >> >> Lemme upgrade. >> >> Note you also need /lib/udev/rules.d/50-firmware.rules removed if >> you have it. I have this: ubuntu@jgarry-ubuntu-bm5-instance-20230215-1843:~/mnt/linux2$ more /lib/udev/rules.d/50-firmware.rules # stub for immediately telling the kernel that userspace firmware loading # failed; necessary to avoid long timeouts with CONFIG_FW_LOADER_USER_HELPER=y SUBSYSTEM=="firmware", ACTION=="add", ATTR{loading}="-1" So I can remove it. > I don't see any hung tasks on next-20240226. Perhaps its with your > config that it is triggered. OK, I'll check again when I get a chance, but I am not so keen on checking linux-next in general. Cheers, John
On 27/02/2024 12:59, Luis Chamberlain wrote: > On Mon, Feb 26, 2024 at 05:13:44PM +0000, John Garry wrote: >> On 26/02/2024 17:10, Luis Chamberlain wrote: >>>>> I am running this now, but it does not seem stable on a v6.8-rc5 baseline. I >>>>> am seeing hangs. Are there any known issues? >>>> I tested next-20240108 and so no issues. >>>> >>>> Lemme upgrade. >>>> >>>> Note you also need /lib/udev/rules.d/50-firmware.rules removed if >>>> you have it. >> I have this: >> ubuntu@jgarry-ubuntu-bm5-instance-20230215-1843:~/mnt/linux2$ more >> /lib/udev/rules.d/50-firmware.rules >> # stub for immediately telling the kernel that userspace firmware loading >> # failed; necessary to avoid long timeouts with >> CONFIG_FW_LOADER_USER_HELPER=y >> SUBSYSTEM=="firmware", ACTION=="add", ATTR{loading}="-1" >> >> So I can remove it. > You can keep it on a distro use case, but for testing it is important to > remove it. ok > >>> I don't see any hung tasks on next-20240226. Perhaps its with your >>> config that it is triggered. >> OK, I'll check again when I get a chance, but I am not so keen on checking >> linux-next in general. > What kernel are you seeing this issue on? I was testing v6.8-rc5 last week Thanks, John
On 27/02/2024 13:50, Luis Chamberlain wrote: > On Tue, Feb 27, 2024 at 01:02:26PM +0000, John Garry wrote: >> On 27/02/2024 12:59, Luis Chamberlain wrote: >>> What kernel are you seeing this issue on? >> I was testing v6.8-rc5 last week > I cannot reproduce a hung task there either on that kernel. > > I see this: > > sysfs: cannot create duplicate filename '/devices/virtual/misc/test_firmware/nope-test-firmware.bin' > > But these are expected as the selftests tries silly things to ensure > they are not allowed. > > If you can reproduce it there, it would be appreciated if you look underneath > the hood a bit, or share anything glaring and obvious which may help > reproduce this. Update: commenting-out /lib/udev/rules.d/50-firmware.rules seems to make the test reliably pass for v6.8-rc5, but not with my patch on top - I still get a hang there. I'll investigate that hang with my patch. Thanks, John
On 28/02/2024 15:18, Luis Chamberlain wrote: >>> But these are expected as the selftests tries silly things to ensure >>> they are not allowed. >>> >>> If you can reproduce it there, it would be appreciated if you look underneath >>> the hood a bit, or share anything glaring and obvious which may help >>> reproduce this. >> Update: commenting-out /lib/udev/rules.d/50-firmware.rules seems to make the >> test reliably pass for v6.8-rc5, > Great, note that if you had a hung task even with the udev rule that is > not expected and is indicative of a bug I cannot reproduce. > >> but not with my patch on top - I still get >> a hang there. I'll investigate that hang with my patch. > So your hang is with the udev rule on vanilla v6.8-rc5 ? > Because for the > life of me, I don't see it. I think that I spoke too soon. After adding debug to see any difference between mainline and my patch, I get this: [ 806.830318] misc test_firmware: Direct firmware load for tmp.k5xh5F4xvG failed with error -2 [ 806.830322] misc test_firmware: Falling back to sysfs fallback for: tmp.k5xh5F4xvG [ 1006.958148] INFO: task fw_filesystem.s:5565 blocked for more than 120 seconds. [ 1007.045111] Not tainted 6.8.0-rc5-g11c039aebb43 #40 [ 1007.110262] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 1007.204462] task:fw_filesystem.s state:D stack:0 pid:5565 tgid:5565 ppid:1 flags:0x00000002 [ 1007.204470] Call Trace: [ 1007.204472] <TASK> [ 1007.204477] __schedule+0x3d7/0x1720 [ 1007.204486] ? ttwu_do_activate+0x7a/0x260 [ 1007.204493] ? try_to_wake_up+0x81/0x6c0 [ 1007.204495] schedule+0x39/0x100 [ 1007.204496] schedule_timeout+0x14f/0x160 [ 1007.204502] ? __queue_work+0x212/0x500 [ 1007.204507] ? fw_devm_match+0x29/0x40 [ 1007.204514] __wait_for_common+0x8f/0x190 [ 1007.204517] ? __pfx_schedule_timeout+0x10/0x10 [ 1007.204520] wait_for_completion+0x28/0x30 [ 1007.204522] trigger_batched_requests_async_store+0x95/0x220 [ 1007.204532] dev_attr_store+0x18/0x30 [ 1007.204539] sysfs_kf_write+0x3f/0x50 [ 1007.204547] kernfs_fop_write_iter+0x140/0x1d0 [ 1007.204550] vfs_write+0x311/0x430 [ 1007.204557] ksys_write+0x6b/0xf0 [ 1007.204560] __x64_sys_write+0x1d/0x30 [ 1007.204562] do_syscall_64+0x77/0x120 [ 1007.204568] ? __count_memcg_events+0x6f/0x110 [ 1007.204576] ? count_memcg_events.constprop.0+0x1e/0x40 [ 1007.204584] ? handle_mm_fault+0x192/0x2f0 [ 1007.204587] ? do_user_addr_fault+0x33f/0x6c0 [ 1007.204594] ? irqentry_exit_to_user_mode+0x6b/0x180 [ 1007.204599] ? irqentry_exit+0x3f/0x50 [ 1007.204601] ? exc_page_fault+0x8e/0x190 [ 1007.204604] entry_SYSCALL_64_after_hwframe+0x6e/0x76 [ 1007.204609] RIP: 0033:0x7f8172b14887 This is without the udev rule. I'll try to now see where this hang really is coming from... but it might take a while. Maybe first I should enable some more debug config options. Thanks, John
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index 3c67f24785fc..9a3671659134 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c @@ -38,7 +38,7 @@ #include <linux/zstd.h> #include <linux/xz.h> -#include <generated/utsrelease.h> +#include <linux/utsname.h> #include "../base.h" #include "firmware.h" @@ -471,9 +471,9 @@ static int fw_decompress_xz(struct device *dev, struct fw_priv *fw_priv, static char fw_path_para[256]; static const char * const fw_path[] = { fw_path_para, - "/lib/firmware/updates/" UTS_RELEASE, + "/lib/firmware/updates/", /* UTS_RELEASE is appended later */ "/lib/firmware/updates", - "/lib/firmware/" UTS_RELEASE, + "/lib/firmware/", /* UTS_RELEASE is appended later */ "/lib/firmware" }; @@ -496,7 +496,7 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv, size_t size; int i, len, maxlen = 0; int rc = -ENOENT; - char *path, *nt = NULL; + char *path, *fw_path_string, *nt = NULL; size_t msize = INT_MAX; void *buffer = NULL; dev_err(device, "%s suffix=%s\n", __func__, suffix); @@ -511,6 +511,12 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv, if (!path) return -ENOMEM; + fw_path_string = __getname(); + if (!fw_path_string) { + __putname(path); + return -ENOMEM; + } + wait_for_initramfs(); for (i = 0; i < ARRAY_SIZE(fw_path); i++) { size_t file_size = 0; @@ -521,16 +527,32 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv, if (!fw_path[i][0]) continue; + len = snprintf(fw_path_string, PATH_MAX, "%s", fw_path[i]); + if (len >= PATH_MAX) { + rc = -ENAMETOOLONG; + break; + } + + /* Special handling to append UTS_RELEASE */ + if ((fw_path[i] != fw_path_para) && (fw_path[i][len - 1] == '/')) { + len = snprintf(fw_path_string, PATH_MAX, "%s%s", + fw_path[i], init_utsname()->release); + if (len >= PATH_MAX) { + rc = -ENAMETOOLONG; + break; + } + } + /* strip off \n from customized path */ - maxlen = strlen(fw_path[i]); + maxlen = strlen(fw_path_string); if (i == 0) { - nt = strchr(fw_path[i], '\n'); + nt = strchr(fw_path_string, '\n'); if (nt) - maxlen = nt - fw_path[i]; + maxlen = nt - fw_path_string; } len = snprintf(path, PATH_MAX, "%.*s/%s%s", - maxlen, fw_path[i], + maxlen, fw_path_string, fw_priv->fw_name, suffix); if (len >= PATH_MAX) { rc = -ENAMETOOLONG; @@ -588,6 +610,7 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv, break; } __putname(path); + __putname(fw_path_string); return rc; }