include/uapi pps.h: increase PPS_MAX_SOURCES value
Rodolfo Giometti
maintainerPATCH 1/2 include/uapi pps.h: increase PPS_MAX_SOURCES value
From: Charlie Johnston <[email protected]>
For consistency with what others use for minors, this change sets PPS_MAX_SOURCES to MINORMASK.
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.
--- include/uapi/linux/pps.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/pps.h +1 -1
@@ -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/* Implementation note: the logical states ``assert'' and ``clear'' * are implemented in terms of the chip register, i.e. ``assert''
Signature · 1 line
2.34.1
Rodolfo Giometti
maintainerPATCH 2/2 include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/pps/pps.c +3 -3
@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",
@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )
@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;
include/uapi/linux/pps.h +0 -1
@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASK/* Implementation note: the logical states ``assert'' and ``clear'' * are implemented in terms of the chip register, i.e. ``assert''
Signature · 1 line
2.34.1
Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 46 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0
include/uapi/linux/pps.h line 29
Quoted 4 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASK
Why change this in patch 1, and then delete this here?
That makes no sense.
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
thanks,
greg k-h
Rodolfo Giometti
maintainerRe: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 49 lines · Greg Kroah-Hartman
Quoted 48 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0@@ -26,7 +26,6 @@#include <linux/types.h>
Quoted 6 lines
include/uapi/linux/pps.h line 29
Quoted 2 lines
include/uapi/linux/pps.h +0
-1#define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the PPS_MAX_SOURCES define, while the second step is about the fact it's now that define is useless.
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 52 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 5 lines
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
RFC's do not document Linux kernel apis.
So if any userspace code breaks, you have to put this back, sorry.
thanks,
greg k-h
Rodolfo Giometti
maintainerRe: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 55 lines · Greg Kroah-Hartman
Quoted 54 lines · Rodolfo Giometti
Quoted 52 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
That makes no sense.
Quoted 7 lines
Quoted 3 lines
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases PPS_MAX_SOURCES value while patch 2/2 drops PPS_MAX_SOURCES define.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing PPS_MAX_SOURCES value is good.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.
Ah, I thought patch 1/2 renamed it.
But why increase it if you are removing it?
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
Quoted 5 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.
You can't change a uapi value either without breaking things :(
thanks,
greg k-h
Rodolfo Giometti
maintainerRe: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 61 lines · Greg Kroah-Hartman
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err =idr_alloc (&pps_idr, pps,0 ,PPS_MAX_SOURCES ,GFP_KERNEL ); + err =idr_alloc (&pps_idr, pps,0 ,MINORMASK ,GFP_KERNEL );if (err <0 ) {if (err == -ENOSPC ) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) {class_destroy (pps_class); -unregister_chrdev_region (pps_devt,PPS_MAX_SOURCES ); +unregister_chrdev_region (pps_devt,MINORMASK ); }static int __init pps_init (void )@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err =alloc_chrdev_region (&pps_devt,0 ,PPS_MAX_SOURCES ,"pps" ); + err =alloc_chrdev_region (&pps_devt,0 ,MINORMASK ,"pps" );if (err <0 ) {pr_err ("failed to allocate char device region\n" ); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@#include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.Ah, I thought patch 1/2 renamed it.
No, patch 1/2 just safely increases PPS_MAX_SOURCES value as other drivers does.
Quoted 1 line
But why increase it if you are removing it?
As I said I splitted the modification in two steps just to highlight that the first step is a better redefinition of PPS_MAX_SOURCES, while the second step drops it since it's useless for userspace. As you noticed this last step is not trivial since it may breaks some userspace programs, but it's also true that RFC2783 doesn't define it, so well written userspace programs should not use that define and then they should not break at all. :)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
OK, I'm going to re-write the changelog text adding this information.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.You can't change a uapi value either without breaking things :(
I see, but in this case what do you suggest to do? Keeping 1/2 and dropping 2/2?
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 95 lines · Rodolfo Giometti
Quoted 61 lines · Greg Kroah-Hartman
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>---
drivers/pps/pps.c | 6 +++---
include/uapi/linux/pps.h| 1 -2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); + err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL); if (err < 0) { if (err == -ENOSPC) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) { class_destroy(pps_class); - unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES); + unregister_chrdev_region(pps_devt, MINORMASK); } static int __init pps_init(void)@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); + err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps"); if (err < 0) { pr_err("failed to allocate char device region\n"); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@ #include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.Ah, I thought patch 1/2 renamed it.
No, patch 1/2 just safely increases
PPS_MAX_SOURCESvalue as other drivers does.Quoted 1 line
But why increase it if you are removing it?
As I said I splitted the modification in two steps just to highlight that the first step is a better redefinition of
PPS_MAX_SOURCES, while the second step drops it since it's useless for userspace. As you noticed this last step is not trivial since it may breaks some userspace programs, but it's also true that RFC2783 doesn't define it, so well written userspace programs should not use that define and then they should not break at all. :)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
OK, I'm going to re-write the changelog text adding this information.
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.You can't change a uapi value either without breaking things :(
I see, but in this case what do you suggest to do? Keeping 1/2 and dropping 2/2?
I'm confused here. Is the problem just that the uapi value cannot be dropped (since it is part of uapi) and only patch 1 can be applied?
Or is it that the uapi value cannot be dropped OR changed so neither patch can be applied? If the latter, how would one go about raising a value like this to allow a higher limit without causing issues for existing uapi users?
Regards,
Charlie Johnston
Rodolfo Giometti
maintainerRe: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 100 lines · Charlie Johnston
Quoted 99 lines · Rodolfo Giometti
Quoted 61 lines · Greg Kroah-Hartman
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); + err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL); if (err < 0) { if (err == -ENOSPC) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) { class_destroy(pps_class); - unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES); + unregister_chrdev_region(pps_devt, MINORMASK); } static int __init pps_init(void)@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); + err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps"); if (err < 0) { pr_err("failed to allocate char device region\n"); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@ #include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.Ah, I thought patch 1/2 renamed it.
No, patch 1/2 just safely increases
PPS_MAX_SOURCESvalue as other drivers does.Quoted 1 line
But why increase it if you are removing it?
As I said I splitted the modification in two steps just to highlight that the first step is a better redefinition of
PPS_MAX_SOURCES, while the second step drops it since it's useless for userspace. As you noticed this last step is not trivial since it may breaks some userspace programs, but it's also true that RFC2783 doesn't define it, so well written userspace programs should not use that define and then they should not break at all. :)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
OK, I'm going to re-write the changelog text adding this information.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
You can't change a uapi value either without breaking things :(
I see, but in this case what do you suggest to do? Keeping 1/2 and dropping 2/2?
I'm confused here. Is the problem just that the uapi value cannot be dropped (since it is part of uapi) and only patch 1 can be applied?
Yes.
Quoted 1 line
Or is it that the uapi value cannot be dropped OR changed so neither patch can be applied?
No.
Quoted 1 line
If the latter, how would one go about raising a value like this to allow a higher limit without causing issues for existing uapi users?
My opinion is that both patches should be applied since, the first one just increases the value of possible PPS sources, while the second just drops a define that userspace tools should NOT use since RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems doesn't define it.
Is some userspace tool breaks, it should be fixed.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 115 lines · Rodolfo Giometti
Quoted 100 lines · Charlie Johnston
Quoted 99 lines · Rodolfo Giometti
Quoted 61 lines · Greg Kroah-Hartman
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>---
drivers/pps/pps.c | 6 +++---
include/uapi/linux/pps.h| 1 -2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); + err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL); if (err < 0) { if (err == -ENOSPC) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) { class_destroy(pps_class); - unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES); + unregister_chrdev_region(pps_devt, MINORMASK); } static int __init pps_init(void)@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); + err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps"); if (err < 0) { pr_err("failed to allocate char device region\n"); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@ #include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.Ah, I thought patch 1/2 renamed it.
No, patch 1/2 just safely increases
PPS_MAX_SOURCESvalue as other drivers does.Quoted 1 line
But why increase it if you are removing it?
As I said I splitted the modification in two steps just to highlight that the first step is a better redefinition of
PPS_MAX_SOURCES, while the second step drops it since it's useless for userspace. As you noticed this last step is not trivial since it may breaks some userspace programs, but it's also true that RFC2783 doesn't define it, so well written userspace programs should not use that define and then they should not break at all. :)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
OK, I'm going to re-write the changelog text adding this information.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.Quoted 5 lines
Quoted 3 lines
Quoted 1 line
You can't change a uapi value either without breaking things :(
I see, but in this case what do you suggest to do? Keeping 1/2 and dropping 2/2?
I'm confused here. Is the problem just that the uapi value cannot be dropped (since it is part of uapi) and only patch 1 can be applied?
Yes.
Quoted 1 line
Or is it that the uapi value cannot be dropped OR changed so neither patch can be applied?
No.
Quoted 1 line
If the latter, how would one go about raising a value like this to allow a higher limit without causing issues for existing uapi users?
Quoted 8 lines
My opinion is that both patches should be applied since, the first one just increases the value of possible PPS sources, while the second just drops a define that userspace tools should NOT use since RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems doesn't define it.
Is some userspace tool breaks, it should be fixed.
Ciao,
Rodolfo
Hi Rodolfo,
Is there any other testing or help I can provide for this patch set?
Thanks!
Charlie Johnston
Rodolfo Giometti
maintainerRe: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES define
Quoted 120 lines · Charlie Johnston
Quoted 119 lines · Rodolfo Giometti
Quoted 100 lines · Charlie Johnston
Quoted 99 lines · Rodolfo Giometti
Quoted 61 lines · Greg Kroah-Hartman
Quoted 60 lines · Rodolfo Giometti
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Rodolfo Giometti
Quoted 51 lines · Greg Kroah-Hartman
Quoted 44 lines · Rodolfo Giometti
Userspace PPS clients should not known about how many PPS sources can be defined within the system (nor the rfc2783 say so), so we can safely drop this define since is not used anymore in the kernel too.
Signed-off-by Rodolfo Giometti <[email protected]>--- drivers/pps/pps.c | 6 +++--- include/uapi/linux/pps.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-)drivers/pps/pps.c +3
-3@@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)* Get new ID for the new PPS source. After idr_alloc() calling * the new source will be freely available into the kernel. */ - err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL); + err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL); if (err < 0) { if (err == -ENOSPC) { pr_err("%s: too many PPS sources in the system\n",@@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev); static void __exit pps_exit(void) { class_destroy(pps_class); - unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES); + unregister_chrdev_region(pps_devt, MINORMASK); } static int __init pps_init(void)@@ -463,7 +463,7 @@ static int __init pps_init(void) } pps_class->dev_groups = pps_groups; - err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); + err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps"); if (err < 0) { pr_err("failed to allocate char device region\n"); goto remove_class;include/uapi/linux/pps.h +0
-0include/uapi/linux/pps.h line 28
Quoted 3 lines
include/uapi/linux/pps.h +0
-1@@ -26,7 +26,6 @@ #include <linux/types.h> #define PPS_VERSION "5.3.6" -#define PPS_MAX_SOURCES MINORMASKWhy change this in patch 1, and then delete this here?
Quoted 1 line
That makes no sense.
I did it in two steps to be clear that the first step is about a better redefinition of the
PPS_MAX_SOURCESdefine, while the second step is about the fact it's now that define is useless.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Better to just convert everything in patch one, and then in patch 2 delete the .h #define. That way, when userspace breaks, you can revert just the last patch :)
I'm puzzled since I did as you say... patch 1/2 increases
PPS_MAX_SOURCESvalue while patch 2/2 dropsPPS_MAX_SOURCESdefine.Ah, I thought patch 1/2 renamed it.
No, patch 1/2 just safely increases
PPS_MAX_SOURCESvalue as other drivers does.Quoted 1 line
But why increase it if you are removing it?
As I said I splitted the modification in two steps just to highlight that the first step is a better redefinition of
PPS_MAX_SOURCES, while the second step drops it since it's useless for userspace. As you noticed this last step is not trivial since it may breaks some userspace programs, but it's also true that RFC2783 doesn't define it, so well written userspace programs should not use that define and then they should not break at all. :)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
And if this is exported to userspace, removing it should break things, right? If not, why was it there in the first place?
In reality such define is not stated within the PPS RFC2783, so userspace programs whose relies on such define are broken.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
RFC's do not document Linux kernel apis.
It's true, but well written PPS clients should relay only on PPS API which in turn doesn't states that define. :P
Are you sure? Have you audited the clients? if so, please document that in the changelog text.
OK, I'm going to re-write the changelog text adding this information.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
So if any userspace code breaks, you have to put this back, sorry.
If you think that patch 2 is not good, no problem, just drop it, but please just consider applying patch 1, since increasing
PPS_MAX_SOURCESvalue is good.Quoted 5 lines
Quoted 3 lines
Quoted 1 line
You can't change a uapi value either without breaking things :(
I see, but in this case what do you suggest to do? Keeping 1/2 and dropping 2/2?
I'm confused here. Is the problem just that the uapi value cannot be dropped (since it is part of uapi) and only patch 1 can be applied?
Yes.
Quoted 1 line
Or is it that the uapi value cannot be dropped OR changed so neither patch can be applied?
No.
Quoted 1 line
If the latter, how would one go about raising a value like this to allow a higher limit without causing issues for existing uapi users?
My opinion is that both patches should be applied since, the first one just increases the value of possible PPS sources, while the second just drops a define that userspace tools should NOT use since RFC 2783 - Pulse-Per-Second API for UNIX-like Operating Systems doesn't define it.
Is some userspace tool breaks, it should be fixed.
Quoted 8 lines
Quoted 4 lines
Ciao,
Rodolfo
Hi Rodolfo,
Is there any other testing or help I can provide for this patch set?
I don't think so... I'll to ask to Greg to just apply the first patch and drop the second one.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti