Message ID | 20230605203147.694716-1-charlie.johnston@ni.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2958033vqr; Mon, 5 Jun 2023 14:16:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5IRMKKI6quEtJ+24ycoxZtecfYYkkmFRQGGurDs8DHKMY3B2eKBBqvcVRkLnr0/EsFT1AA X-Received: by 2002:ac8:5b91:0:b0:3f5:3678:f4d8 with SMTP id a17-20020ac85b91000000b003f53678f4d8mr10206902qta.56.1685999793797; Mon, 05 Jun 2023 14:16:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685999793; cv=pass; d=google.com; s=arc-20160816; b=F6mWkWgVD8FuLRfwCifYBn/AAEed1xLFl0N6Xnpi6bAd9ECCtxbL9dv6enQS9NJ2t9 At8uwECoOVsg020+u0IV22cz/p/ifAyC9T5xFZEw+ln8GX/TXdCs2Qd9GcLPBvl/9qGh ee8jUcqRTviB0o0irt7Yi7SYrizIP1fhS4gSqwsFxKHl5jtKjM9vLQEMKOXL8RAHFPWF ryPxb4S21muO4SxF1UZB2Gpb5ncZ7AvFb8Altl9leegG5zwUuLXPwTq1+yleh3m7O4HL Ad9DhhGcCi4zqNMHm9HloxcxcUBTycTzlK2yTSvAyO+PzVCiy4xqCJdznthCb+dFgGJR mmqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=DOwu1+gZ8vxDq2j/wAavKJawBvXDny5D/yRgn1j4qfo=; b=jdyU5RfzKghcIhNPmrcAca2nIwLzd0tpj+kXBS02WhQZr3nEImXykFhAajIzibRt+F QA4YyV6A5yd5ZH5P4rvXcP8VTPBLA9LXsroltn1d9BOCrpPvtlkSG8YV3c32wk4J2vf4 v0+0XNL8WxQPjCSx00mIDxA33KmMQY8sfFJV43qQstH+srSzANIBcFuSJ7dsWVHLioBU I9ilDVZwqVDsrs0x/DcjCCZNSAxtSP4DiN0VK0xK564PRMcpU+f0DN5IipnMdURxJk6A g2+fVVZY7GaYrd/JXCWogyIkam+MfuOIADoCv4lReQVS030AtczN7kdlFzL+T0aAfRuj FbfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ni.com header.s=PPS11062020 header.b=LQQLKNEh; dkim=pass header.i=@nio365.onmicrosoft.com header.s=selector2-nio365-onmicrosoft-com header.b=YPQnICyP; arc=pass (i=1 spf=pass spfdomain=ni.com dkim=pass dkdomain=ni.com dmarc=pass fromdomain=ni.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ni.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a05622a164e00b003e80629bd5bsi5241057qtj.266.2023.06.05.14.16.19; Mon, 05 Jun 2023 14:16:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ni.com header.s=PPS11062020 header.b=LQQLKNEh; dkim=pass header.i=@nio365.onmicrosoft.com header.s=selector2-nio365-onmicrosoft-com header.b=YPQnICyP; arc=pass (i=1 spf=pass spfdomain=ni.com dkim=pass dkdomain=ni.com dmarc=pass fromdomain=ni.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ni.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbjFEVGz (ORCPT <rfc822;xxoosimple@gmail.com> + 99 others); Mon, 5 Jun 2023 17:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbjFEVGx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 5 Jun 2023 17:06:53 -0400 X-Greylist: delayed 2069 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 05 Jun 2023 14:06:52 PDT Received: from mx0b-00010702.pphosted.com (mx0b-00010702.pphosted.com [148.163.158.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C8EED for <linux-kernel@vger.kernel.org>; Mon, 5 Jun 2023 14:06:52 -0700 (PDT) Received: from pps.filterd (m0098779.ppops.net [127.0.0.1]) by mx0b-00010702.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 355EsYuY004989; Mon, 5 Jun 2023 15:32:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ni.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=PPS11062020; bh=DOwu1+gZ8vxDq2j/wAavKJawBvXDny5D/yRgn1j4qfo=; b=LQQLKNEhIFiBYcxqEp9W8UL/cqVqb9Nvej49V6qGXakgW93alRcrdXrH9PFsNyPszZLn nVBi02UuNnbpCO/zwFEteVufxiROlWNBHeJ+6jZgSbcDJ4naUYUCUG65oDsuYh935lvf RnnURsh9Klsm9XSSKKhKujshrp1SDgfG3m/UPdHxTmUMUCxPLV1JDoqVrY/PJG86rnab 7VVHnC3od1E6GBC4DdWLeVdRx2HBzG3A2PcYf/Cch4z/MrUJ91fmdx29NJYGHQWOH03u fPsgxNb/KsACBqTVyfKY/5l2maqWLPf0pDygaEJiEJ3FP1A4pGdHLXzLn9A3u6jIi8Mb Xw== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2043.outbound.protection.outlook.com [104.47.56.43]) by mx0b-00010702.pphosted.com (PPS) with ESMTPS id 3r03b5uhpq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Jun 2023 15:32:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdjN/wIBwW2Fjcek3olhOP8DmepdwJNPfk+wMq/34F17qKS+EGPFBnXpcxaXlX6N+2+m+iWCWFykTI1FButStbbN4gn/VoO0F9w7IecIvN4pNLi+HqiwdE+OkLzNRORGYEgzS+TlDdIx/N38I6Zdxa6tcTTqvjW70DUexQW2Tdar8OZWPOHXVhUIChu9NQl9WwsC/EPTFSJE8hvOZ7CemyBcQ6uaqvWmUTZFnm+/s00frchrxs31MrgD7PuhdvVyf73d4F1mb9hTQw0lvdE2cicOJlXocREliEJaktPK99shlax/exA8D+2u8ijzlh1jYgvIzpOiB2z3CBdZrcqgew== 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=DOwu1+gZ8vxDq2j/wAavKJawBvXDny5D/yRgn1j4qfo=; b=gVtj/zpfXN4vXc42kbBiFN14roE293/2EZkLUdiYY21G4+jlsbKFGFmH0A3XBtgmBfNo4GM7EtpKlbBRPgk07XRueLi0wb/0092sjQvJvfMh0N1JKG11nPmBa3REI+nObSE7wAF6/PjWRBrM/vT5bf5r/5Fpaa4+Aq5XPG2562Hm268/O5eXfi/Nn3qFnH3OKcprO/oOzLhXLXMz5h7GwEQvvK81RBpPwam8yMOBOfRrWDX/KeBKXGFK2EPZCMPZNZU7G1uQRht44tlpW64qWpdI4kmtWzd4asp088jxCi1h9CmEO3/7plfDObC75+L3nmns6D+nw7/FeTJSc7gvEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ni.com; dmarc=pass action=none header.from=ni.com; dkim=pass header.d=ni.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nio365.onmicrosoft.com; s=selector2-nio365-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DOwu1+gZ8vxDq2j/wAavKJawBvXDny5D/yRgn1j4qfo=; b=YPQnICyPywUEkzgES8E2m+IIfR8Px6ery7g5VhQryZxnk05Oyt8l3EmxpbZDpXBvEMULs2DxDh/cb7T/mFzbyiqbgkbLzr6tzrv/Jn3zG2MMD86TeJmBbdEC/EmSSB3BWDAj8V/ttncVpcP3bRwiukZlrqSTrt3tkKuT1EsWw+4= Received: from SN6PR04MB4879.namprd04.prod.outlook.com (2603:10b6:805:9b::29) by BY5PR04MB6326.namprd04.prod.outlook.com (2603:10b6:a03:1ed::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Mon, 5 Jun 2023 20:32:17 +0000 Received: from SN6PR04MB4879.namprd04.prod.outlook.com ([fe80::f64d:f407:7c9c:4af0]) by SN6PR04MB4879.namprd04.prod.outlook.com ([fe80::f64d:f407:7c9c:4af0%5]) with mapi id 15.20.6455.030; Mon, 5 Jun 2023 20:32:17 +0000 From: Charlie Johnston <charlie.johnston@ni.com> To: giometti@enneenne.com Cc: linux-kernel@vger.kernel.org, brenda.streiff@ni.com, Charlie Johnston <charlie.johnston@ni.com> Subject: [RFC PATCH] pps: Increase PPS_MAX_SOURCES value. Date: Mon, 5 Jun 2023 15:31:47 -0500 Message-Id: <20230605203147.694716-1-charlie.johnston@ni.com> X-Mailer: git-send-email 2.30.2 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SN6PR2101CA0009.namprd21.prod.outlook.com (2603:10b6:805:106::19) To SN6PR04MB4879.namprd04.prod.outlook.com (2603:10b6:805:9b::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR04MB4879:EE_|BY5PR04MB6326:EE_ X-MS-Office365-Filtering-Correlation-Id: c9ba1744-f25d-4b6a-6a61-08db6603f463 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PiAS9JbTJHzQNj84WZuSTW+QeNQRbj3X0yU3gUNRsBZ6jaTo/0zjOhfBXDZMtj3H05MSoFzzbwFK5kFCbybZLzDAV7s1Sd/vMi5jYkTI/Kuu+4hKprIss+H0Gqrk0gUawp/5FHwXVeyBY1n33ur+PzssXzpzpB9puFpczTf/wl7Prt5l72JKlmevohnWZ3t3t0yL8o1ii8y/Du8N4/SL/5azZpraV3tkbRksKJ6pBG3y+HG9ljb0BILk3m75mNSE0O4ZFZhKfRIffH2xqacg4zDeYsU+fNZd4946bgsvpwWaS/ddpN6xXaPyXU1RiZyAFF01l7PZdzQVvJn7j95aRuf9DDgJQvYjpjKo31nKR/v/U2ejXf/ZUqsZMKYlF2mYcqGpuGeJT3U5BvvD/urfDeI9qINbFrNbzSjgFqAxqrKgwFkYO2yv+K/0D7a+ECfwAdU8tBHdU6/N+ztBjiJdSrBTlw5MXWsCygRK8JsgfII73g6KbAWxT38euykSUkYTtOHMKBuN4H14eVY8Fsqgvs8K35BIz6cPnrIKQ6/gRCxCnAS0LDxU4dtTS60VZnOu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR04MB4879.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(396003)(39850400004)(376002)(346002)(136003)(451199021)(83380400001)(44832011)(478600001)(8676002)(8936002)(41300700001)(316002)(66556008)(66476007)(66946007)(5660300002)(6916009)(4326008)(38100700002)(86362001)(6486002)(36756003)(6666004)(4744005)(2906002)(26005)(6512007)(186003)(6506007)(1076003)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: onEVan/EYb1ODsMfag8C4eiMW/LzEU8PTT/hsXh0RcBfZLT83VB41aQF1Pf4gdOhBL+JkbmYwAcWiV1aUS0VQShsnIuDK1ahUnE3S1RcXh0iAkMnwVDpO1AA5+oNp578cwdBziTXe43jDa2DRRQTVNZEP4kpJkuDcgEpJNBcqSFIdNar/q9mO13onJ/GaaRNhBUFB1kAc4XKBvTNaZ2cCaFeLn6rRkYJ10G6hHv8je0HJ543yDYMDJCQqi9u/YwyCMlfQSfCoItdVhfHz8LQgQ1HbvTLixBwEelx2YaXP+MtqJU2e72YQmBcHxFjaCQkzLMhddH4wp6u88otqEjfBvlVj/5qvyKoAd9+ImBjEKVuI6v04M4kY8fAca1FDJYh2cY5cG7s5BJuEFn3PiEbkoja12ZGo1iXFeuxFhWiTlyFqvE1QmHHabTU/7pBhZ2wl9ftNovSJsEjuicUxs34HhUfLgyfDXhzTFgG/XB9iQzw19TrEz6NaA4KgaRpkT3eXnXQbybZb1wGedrhkWuhH/RZh1mSh15FrKqmHKKlO5INiKANYLuMJlOAPwhGWtFNCpggA8Og0TtIFO6XIEdJg7RamNLJQkUvt2ClLd8am0SGDWB84MSl2+cvxGh2TPypkSVAed1FJgNR0olUJva7NCPKkAt8Hy/GggOwevDBtr5FvyQC/aduy4nBSkJR9XYt7x8CwNE5XMrnlbZuhae3Y/M5YI5+HitKL4kL6iBstYDXzF8yRKbMaoA5cBDlx0wcUvsAfl8tCoQAfysFWtK+tvBEMPi03wouKy/eSEf1iOgo6qTzmNyIiiXwrn6cLgVIVdCCeKyllJLZCVyGaA3enQUzHI63i7P1aPj0GQSy9bemufG8eBM8x1Sq9EmOyrUNuNF9raZ7c+o4ibsb6mW8UqGGaCeI3O4t4Lo2f9MFhc3C+C/1DoIbvFvZB2zZGTK5E3IbQhnu1GEPcI+4+a5PlcSHZ83QNlLXqNZONgMAU4Y9pfQRjw5hW/zInRUjU2k4DMxwONkkjEuW8iDdAx8QUXiShbdqca+Kp0Eg2x2KATkEMuVEawI49FhAVupeHBnh1JYuEgDHvDjNDtsTYS1D1OR4eRCfmBwe+0rTdFQ0kXUQ4Ll7ODsi/uKsCo5Kkk9Mw5RV4VoTq7sOy1A8jAQUtJpm+aUmASejyt0vqTAbU4fBUCdBKlZ+e9zi7PImafMI9sbATsVmQvRTVlQMjExDvLaHoMdVu1VXkB9v+jzWd5x+8t+1HV2r+VFMGGB5YffbQqokQLTjfaGVzGIUNpgJaT6ZLRfjOlOhShQMCDtjc8rMIuXMqijug1ZgBQ0dKAtW/O+4QTKyaH2r2c5pdY5cYbFmPbkBmQFz6FyLDnfAupG0bshKxxPaFuUnIlUv/Taw/xKVQk4RjvJIbBCm0NFs4HPzwYT3iIji2FsRffvr5IN60MsjE/esgr7Ng69zKGaA41FI+kf0p53qJMRBEPav9vtAK+aJCd3oCZRDE47TDmV5XWGVU7DTWe/QWEV4F9mxJy8gDrqSDB6bfrsVShFtiL59QUx/57/sFj8zWu+MkAwzRAyZVBeTqfdP/SiQARez2fg94ifEyORR+nqBHMMkHg== X-OriginatorOrg: ni.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9ba1744-f25d-4b6a-6a61-08db6603f463 X-MS-Exchange-CrossTenant-AuthSource: SN6PR04MB4879.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2023 20:32:17.5138 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 87ba1f9a-44cd-43a6-b008-6fdb45a5204e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3YNR7FoI1CtiNlbWehrwf1iCdbp6jEv8GBwqymLc6fZq7Qq7tI63uVNkwkEFgiQcRibNRjqoN7FLOXTKawl3zQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR04MB6326 X-Proofpoint-GUID: -pfKLAO1mLekgMNh1U4Yuw3TUU1S93FU X-Proofpoint-ORIG-GUID: -pfKLAO1mLekgMNh1U4Yuw3TUU1S93FU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-05_32,2023-06-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=31 phishscore=0 priorityscore=1501 suspectscore=0 adultscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 malwarescore=0 bulkscore=0 mlxlogscore=220 spamscore=1 mlxscore=1 classifier=spam adjust=30 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2306050176 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767898919847312493?= X-GMAIL-MSGID: =?utf-8?q?1767898919847312493?= |
Series |
[RFC] pps: Increase PPS_MAX_SOURCES value.
|
|
Commit Message
Charlie Johnston
June 5, 2023, 8:31 p.m. UTC
For consistency with what ptp uses for minors, this
change sets PPS_MAX_SOURCES to MINORMASK + 1.
The PPS_MAX_SOURCES value is currently set to 16. In
some cases this was not sufficient for a system. For
example, a system with multiple (4+) PCIe cards each
with 4 PTP-capable ethernet interfaces could run out
of the available PPS major:minors if each interface
registers a PPS source.
Signed-off-by: Charlie Johnston <charlie.johnston@ni.com>
---
include/uapi/linux/pps.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 05/06/23 22:31, Charlie Johnston wrote: > For consistency with what ptp uses for minors, this > change sets PPS_MAX_SOURCES to MINORMASK + 1. > > The PPS_MAX_SOURCES value is currently set to 16. In > some cases this was not sufficient for a system. For > example, a system with multiple (4+) PCIe cards each > with 4 PTP-capable ethernet interfaces could run out > of the available PPS major:minors if each interface > registers a PPS source. > > Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> > --- > include/uapi/linux/pps.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h > index 009ebcd8ced5..85f472330da8 100644 > --- a/include/uapi/linux/pps.h > +++ b/include/uapi/linux/pps.h > @@ -26,7 +26,7 @@ > #include <linux/types.h> > > #define PPS_VERSION "5.3.6" > -#define PPS_MAX_SOURCES 16 /* should be enough... */ > +#define PPS_MAX_SOURCES (MINORMASK + 1) > > /* Implementation note: the logical states ``assert'' and ``clear'' > * are implemented in terms of the chip register, i.e. ``assert'' I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? Ciao, Rodolfo
On 6/7/23 02:33, Rodolfo Giometti wrote: > On 05/06/23 22:31, Charlie Johnston wrote: >> For consistency with what ptp uses for minors, this >> change sets PPS_MAX_SOURCES to MINORMASK + 1. >> >> The PPS_MAX_SOURCES value is currently set to 16. In >> some cases this was not sufficient for a system. For >> example, a system with multiple (4+) PCIe cards each >> with 4 PTP-capable ethernet interfaces could run out >> of the available PPS major:minors if each interface >> registers a PPS source. >> >> Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> >> --- >> include/uapi/linux/pps.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h >> index 009ebcd8ced5..85f472330da8 100644 >> --- a/include/uapi/linux/pps.h >> +++ b/include/uapi/linux/pps.h >> @@ -26,7 +26,7 @@ >> #include <linux/types.h> >> #define PPS_VERSION "5.3.6" >> -#define PPS_MAX_SOURCES 16 /* should be enough... */ >> +#define PPS_MAX_SOURCES (MINORMASK + 1) >> /* Implementation note: the logical states ``assert'' and ``clear'' >> * are implemented in terms of the chip register, i.e. ``assert'' > > I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? > > Ciao, > > Rodolfo > Thanks for taking a look! My understanding is that idr_alloc(..., start, end, ...) can take any end value up to INT_MAX. It also handles any values <= 0 by treating them as equal to INT_MAX + 1 since the end value is non-inclusive. I can't think of any reason using MINORMASK + 1 here would be an issue since it's much less than the maximum value idr_alloc() allows. A number of drivers (e.g. ptp) just explicitly use a start and end value of 0, but I don't think that change would fit here. Regards, Charlie
On 08/06/23 00:07, Charlie Johnston wrote: > On 6/7/23 02:33, Rodolfo Giometti wrote: >> On 05/06/23 22:31, Charlie Johnston wrote: >>> For consistency with what ptp uses for minors, this >>> change sets PPS_MAX_SOURCES to MINORMASK + 1. >>> >>> The PPS_MAX_SOURCES value is currently set to 16. In >>> some cases this was not sufficient for a system. For >>> example, a system with multiple (4+) PCIe cards each >>> with 4 PTP-capable ethernet interfaces could run out >>> of the available PPS major:minors if each interface >>> registers a PPS source. >>> >>> Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> >>> --- >>> include/uapi/linux/pps.h | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h >>> index 009ebcd8ced5..85f472330da8 100644 >>> --- a/include/uapi/linux/pps.h >>> +++ b/include/uapi/linux/pps.h >>> @@ -26,7 +26,7 @@ >>> #include <linux/types.h> >>> #define PPS_VERSION "5.3.6" >>> -#define PPS_MAX_SOURCES 16 /* should be enough... */ >>> +#define PPS_MAX_SOURCES (MINORMASK + 1) >>> /* Implementation note: the logical states ``assert'' and ``clear'' >>> * are implemented in terms of the chip register, i.e. ``assert'' >> >> I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? >> >> Ciao, >> >> Rodolfo >> > > Thanks for taking a look! > > My understanding is that idr_alloc(..., start, end, ...) can take any end value up to INT_MAX. It also handles any values <= 0 by treating them as equal to INT_MAX + 1 since the end value is non-inclusive. I can't think of any reason using MINORMASK + 1 here would be an issue since it's much less than the maximum value idr_alloc() allows. > > A number of drivers (e.g. ptp) just explicitly use a start and end value of 0, but I don't think that change would fit here. I see and maybe I should replace the usage of idr_*() with ida_*() as PTP does... However the right-thing(TM) to do here should be dropping PPS_MAX_SOURCES at all! Let me go deeper in this issue. I'm going to produce a patch set in next days. Have you any chances to test it? Ciao, Rodolfo
On 6/9/23 02:30, Rodolfo Giometti wrote: > On 08/06/23 00:07, Charlie Johnston wrote: >> On 6/7/23 02:33, Rodolfo Giometti wrote: >>> On 05/06/23 22:31, Charlie Johnston wrote: >>>> For consistency with what ptp uses for minors, this >>>> change sets PPS_MAX_SOURCES to MINORMASK + 1. >>>> >>>> The PPS_MAX_SOURCES value is currently set to 16. In >>>> some cases this was not sufficient for a system. For >>>> example, a system with multiple (4+) PCIe cards each >>>> with 4 PTP-capable ethernet interfaces could run out >>>> of the available PPS major:minors if each interface >>>> registers a PPS source. >>>> >>>> Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> >>>> --- >>>> include/uapi/linux/pps.h | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h >>>> index 009ebcd8ced5..85f472330da8 100644 >>>> --- a/include/uapi/linux/pps.h >>>> +++ b/include/uapi/linux/pps.h >>>> @@ -26,7 +26,7 @@ >>>> #include <linux/types.h> >>>> #define PPS_VERSION "5.3.6" >>>> -#define PPS_MAX_SOURCES 16 /* should be enough... */ >>>> +#define PPS_MAX_SOURCES (MINORMASK + 1) >>>> /* Implementation note: the logical states ``assert'' and ``clear'' >>>> * are implemented in terms of the chip register, i.e. ``assert'' >>> >>> I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? >>> >>> Ciao, >>> >>> Rodolfo >>> >> >> Thanks for taking a look! >> >> My understanding is that idr_alloc(..., start, end, ...) can take any end value up to INT_MAX. It also handles any values <= 0 by treating them as equal to INT_MAX + 1 since the end value is non-inclusive. I can't think of any reason using MINORMASK + 1 here would be an issue since it's much less than the maximum value idr_alloc() allows. >> >> A number of drivers (e.g. ptp) just explicitly use a start and end value of 0, but I don't think that change would fit here. > > I see and maybe I should replace the usage of idr_*() with ida_*() as PTP does... > > However the right-thing(TM) to do here should be dropping PPS_MAX_SOURCES at all! > > Let me go deeper in this issue. I'm going to produce a patch set in next days. Have you any chances to test it? > > Ciao, > > Rodolfo > I'll have to check when the system we used for testing is available again (not easy to find a system with 20+ Ethernet ports) but I'd be happy to test a patch! I know an increase to PPS_MAX_SOURCES was tested on that system. Thanks, Charlie
On 09/06/23 23:00, Charlie Johnston wrote: > On 6/9/23 02:30, Rodolfo Giometti wrote: >> On 08/06/23 00:07, Charlie Johnston wrote: >>> On 6/7/23 02:33, Rodolfo Giometti wrote: >>>> On 05/06/23 22:31, Charlie Johnston wrote: >>>>> For consistency with what ptp uses for minors, this >>>>> change sets PPS_MAX_SOURCES to MINORMASK + 1. >>>>> >>>>> The PPS_MAX_SOURCES value is currently set to 16. In >>>>> some cases this was not sufficient for a system. For >>>>> example, a system with multiple (4+) PCIe cards each >>>>> with 4 PTP-capable ethernet interfaces could run out >>>>> of the available PPS major:minors if each interface >>>>> registers a PPS source. >>>>> >>>>> Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> >>>>> --- >>>>> include/uapi/linux/pps.h | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h >>>>> index 009ebcd8ced5..85f472330da8 100644 >>>>> --- a/include/uapi/linux/pps.h >>>>> +++ b/include/uapi/linux/pps.h >>>>> @@ -26,7 +26,7 @@ >>>>> #include <linux/types.h> >>>>> #define PPS_VERSION "5.3.6" >>>>> -#define PPS_MAX_SOURCES 16 /* should be enough... */ >>>>> +#define PPS_MAX_SOURCES (MINORMASK + 1) >>>>> /* Implementation note: the logical states ``assert'' and ``clear'' >>>>> * are implemented in terms of the chip register, i.e. ``assert'' >>>> >>>> I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? >>>> >>>> Ciao, >>>> >>>> Rodolfo >>>> >>> >>> Thanks for taking a look! >>> >>> My understanding is that idr_alloc(..., start, end, ...) can take any end value up to INT_MAX. It also handles any values <= 0 by treating them as equal to INT_MAX + 1 since the end value is non-inclusive. I can't think of any reason using MINORMASK + 1 here would be an issue since it's much less than the maximum value idr_alloc() allows. >>> >>> A number of drivers (e.g. ptp) just explicitly use a start and end value of 0, but I don't think that change would fit here. >> >> I see and maybe I should replace the usage of idr_*() with ida_*() as PTP does... >> >> However the right-thing(TM) to do here should be dropping PPS_MAX_SOURCES at all! >> >> Let me go deeper in this issue. I'm going to produce a patch set in next days. Have you any chances to test it? >> >> Ciao, >> >> Rodolfo >> > MINORMASK > I'll have to check when the system we used for testing is available again (not easy to find a system with 20+ Ethernet ports) but I'd be happy to test a patch! Great! Please, let me know. > I know an increase to PPS_MAX_SOURCES was tested on that system. I see and it seems that it's safer to set PPS_MAX_SOURCES to MINORMASK... so please reproduce your patch with this simple modification, then I'm going to produce a patch to drop the PPS_MAX_SOURCES define since it's not needed anymore. After that you should test all these modifications in order to safely add them to Linux. Ciao, Rodolfo
On 6/12/23 11:07, Rodolfo Giometti wrote: > On 09/06/23 23:00, Charlie Johnston wrote: >> On 6/9/23 02:30, Rodolfo Giometti wrote: >>> On 08/06/23 00:07, Charlie Johnston wrote: >>>> On 6/7/23 02:33, Rodolfo Giometti wrote: >>>>> On 05/06/23 22:31, Charlie Johnston wrote: >>>>>> For consistency with what ptp uses for minors, this >>>>>> change sets PPS_MAX_SOURCES to MINORMASK + 1. >>>>>> >>>>>> The PPS_MAX_SOURCES value is currently set to 16. In >>>>>> some cases this was not sufficient for a system. For >>>>>> example, a system with multiple (4+) PCIe cards each >>>>>> with 4 PTP-capable ethernet interfaces could run out >>>>>> of the available PPS major:minors if each interface >>>>>> registers a PPS source. >>>>>> >>>>>> Signed-off-by: Charlie Johnston <charlie.johnston@ni.com> >>>>>> --- >>>>>> include/uapi/linux/pps.h | 2 +- >>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h >>>>>> index 009ebcd8ced5..85f472330da8 100644 >>>>>> --- a/include/uapi/linux/pps.h >>>>>> +++ b/include/uapi/linux/pps.h >>>>>> @@ -26,7 +26,7 @@ >>>>>> #include <linux/types.h> >>>>>> #define PPS_VERSION "5.3.6" >>>>>> -#define PPS_MAX_SOURCES 16 /* should be enough... */ >>>>>> +#define PPS_MAX_SOURCES (MINORMASK + 1) >>>>>> /* Implementation note: the logical states ``assert'' and ``clear'' >>>>>> * are implemented in terms of the chip register, i.e. ``assert'' >>>>> >>>>> I have just one question: are you sure that it's safe to call idr_alloc(..., 0, (MINORMASK + 1), ...)? >>>>> >>>>> Ciao, >>>>> >>>>> Rodolfo >>>>> >>>> >>>> Thanks for taking a look! >>>> >>>> My understanding is that idr_alloc(..., start, end, ...) can take any end value up to INT_MAX. It also handles any values <= 0 by treating them as equal to INT_MAX + 1 since the end value is non-inclusive. I can't think of any reason using MINORMASK + 1 here would be an issue since it's much less than the maximum value idr_alloc() allows. >>>> >>>> A number of drivers (e.g. ptp) just explicitly use a start and end value of 0, but I don't think that change would fit here. >>> >>> I see and maybe I should replace the usage of idr_*() with ida_*() as PTP does... >>> >>> However the right-thing(TM) to do here should be dropping PPS_MAX_SOURCES at all! >>> >>> Let me go deeper in this issue. I'm going to produce a patch set in next days. Have you any chances to test it? >>> >>> Ciao, >>> >>> Rodolfo >>> >> MINORMASK >> I'll have to check when the system we used for testing is available again (not easy to find a system with 20+ Ethernet ports) but I'd be happy to test a patch! > > Great! Please, let me know. > >> I know an increase to PPS_MAX_SOURCES was tested on that system. > > I see and it seems that it's safer to set PPS_MAX_SOURCES to MINORMASK... so please reproduce your patch with this simple modification, then I'm going to produce a patch to drop the PPS_MAX_SOURCES define since it's not needed anymore. > > After that you should test all these modifications in order to safely add them to Linux. > > Ciao, > > Rodolfo > I've resubmitted the patch with just PPS_MAX_SOURCES = MINORMASK. The system which hits the limit and causes the problem is currently available for testing. Is there anything you'd like me to try running? Or just confirm the limit change works? Thanks, Charlie
On 20/06/23 22:42, Charlie Johnston wrote: > I've resubmitted the patch with just PPS_MAX_SOURCES = MINORMASK. The system which hits the limit and causes the problem is currently available for testing. > > Is there anything you'd like me to try running? Or just confirm the limit change works? Sorry for the delay (i was very busy in these days)! Please, test the attached two patches. Ciao, Rodolfo
On 6/21/23 10:31, Rodolfo Giometti wrote: > On 20/06/23 22:42, Charlie Johnston wrote: >> I've resubmitted the patch with just PPS_MAX_SOURCES = MINORMASK. The system which hits the limit and causes the problem is currently available for testing. >> >> Is there anything you'd like me to try running? Or just confirm the limit change works? > > Sorry for the delay (i was very busy in these days)! Please, test the attached > two patches. > > Ciao, > > Rodolfo > Had some time to test today. Everything I tried appeared to work and the message log indicated sources were available for each port. [ 1.853052] pps_core: LinuxPPS API ver. 1 registered [ 2.749945] pps pps0: new PPS source ptp0 [ 2.790179] pps pps1: new PPS source ptp1 [ 2.818900] pps pps2: new PPS source ptp3 ... [ 6.326282] pps pps26: new PPS source ptp27 [ 6.354941] pps pps27: new PPS source ptp28 [ 6.383575] pps pps28: new PPS source ptp29 Thanks for the quick turnaround on the patches! Charlie
diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h index 009ebcd8ced5..85f472330da8 100644 --- a/include/uapi/linux/pps.h +++ b/include/uapi/linux/pps.h @@ -26,7 +26,7 @@ #include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES 16 /* should be enough... */ +#define PPS_MAX_SOURCES (MINORMASK + 1) /* Implementation note: the logical states ``assert'' and ``clear'' * are implemented in terms of the chip register, i.e. ``assert''