* Export clocks_calc_mult_shift() function @ 2016-03-08 22:25 Murali Karicheri 2016-03-08 22:53 ` John Stultz 2016-03-14 15:27 ` Murali Karicheri 0 siblings, 2 replies; 8+ messages in thread From: Murali Karicheri @ 2016-03-08 22:25 UTC (permalink / raw) To: linux-kernel, john.stultz, tglx; +Cc: Kristo, Tero Hi, I found a patch posted sometime back to export the clocksource function clocks_calc_mult_shift() so that it can be called by drivers that are dynamically loadable. I have not seen any comment against this. Wondering why this is not merged. We require this function exported for use in our driver as well. Can you merge the patch please. Or do you suggest me to repost the same? http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html Thanks -- Murali Karicheri Linux Kernel, Keystone ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-08 22:25 Export clocks_calc_mult_shift() function Murali Karicheri @ 2016-03-08 22:53 ` John Stultz 2016-03-14 15:27 ` Murali Karicheri 1 sibling, 0 replies; 8+ messages in thread From: John Stultz @ 2016-03-08 22:53 UTC (permalink / raw) To: Murali Karicheri; +Cc: lkml, Thomas Gleixner, Kristo, Tero On Wed, Mar 9, 2016 at 5:25 AM, Murali Karicheri <m-karicheri2@ti.com> wrote: > Hi, > > I found a patch posted sometime back to export the clocksource > function clocks_calc_mult_shift() so that it can be called by > drivers that are dynamically loadable. I have not seen any > comment against this. Wondering why this is not merged. We require > this function exported for use in our driver as well. Can you merge > the patch please. Or do you suggest me to repost the same? Why would the clocksource driver need to calculate the hz/shift value instead of using the clocksource_register_hz/khz functions? thanks -john ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-08 22:25 Export clocks_calc_mult_shift() function Murali Karicheri 2016-03-08 22:53 ` John Stultz @ 2016-03-14 15:27 ` Murali Karicheri 2016-03-30 16:46 ` Murali Karicheri 1 sibling, 1 reply; 8+ messages in thread From: Murali Karicheri @ 2016-03-14 15:27 UTC (permalink / raw) To: linux-kernel, john.stultz, tglx; +Cc: Kristo, Tero On 03/08/2016 05:25 PM, Murali Karicheri wrote: > Hi, > > I found a patch posted sometime back to export the clocksource > function clocks_calc_mult_shift() so that it can be called by > drivers that are dynamically loadable. I have not seen any > comment against this. Wondering why this is not merged. We require > this function exported for use in our driver as well. Can you merge > the patch please. Or do you suggest me to repost the same? > > http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html > > Thanks > John, Some reason, your response didn't make into my inbox. So I am reproducing it below. >Why would the clocksource driver need to calculate the hz/shift value >instead of using the clocksource_register_hz/khz functions? > >thanks >-john John, In this use case, the timestamp for Tx/Rx is generated by a firmware that attach the timestamp raw count to the packet meta data when the same is received from the Packet Accelerator h/w at the ingress. We need to convert this raw count value to nano second and use a code like this. /* Convert a raw PA timer count to nanoseconds */ static inline u64 tstamp_raw_to_ns(struct pa_core_device *core_dev, u32 lo, u32 hi) { u32 mult = core_dev->timestamp_info.mult; u32 shift = core_dev->timestamp_info.shift; u64 result; /* Minimize overflow errors by doing this in pieces */ result = ((u64)lo * mult) >> shift; result += ((u64)hi << (32 - shift)) * mult; return result; } The mult, shift values are obtained using the existing clocks_calc_mult_shift() that will not work, if our driver is built as a dynamically loadable module as the symbol is not exported. Is there an alternative way of doing this without exporting this function. clocksource_register_hz/khz() can't help in this, right? -- Murali Karicheri Linux Kernel, Keystone ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-14 15:27 ` Murali Karicheri @ 2016-03-30 16:46 ` Murali Karicheri 2016-03-30 17:01 ` John Stultz 0 siblings, 1 reply; 8+ messages in thread From: Murali Karicheri @ 2016-03-30 16:46 UTC (permalink / raw) To: linux-kernel, john.stultz, tglx; +Cc: Kristo, Tero On 03/14/2016 11:27 AM, Murali Karicheri wrote: > On 03/08/2016 05:25 PM, Murali Karicheri wrote: >> Hi, >> >> I found a patch posted sometime back to export the clocksource >> function clocks_calc_mult_shift() so that it can be called by >> drivers that are dynamically loadable. I have not seen any >> comment against this. Wondering why this is not merged. We require >> this function exported for use in our driver as well. Can you merge >> the patch please. Or do you suggest me to repost the same? >> >> http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html >> >> Thanks >> > John, > > Some reason, your response didn't make into my inbox. So I am > reproducing it below. > >> Why would the clocksource driver need to calculate the hz/shift value >> instead of using the clocksource_register_hz/khz functions? >> >> thanks >> -john > > John, > > In this use case, the timestamp for Tx/Rx is generated by a firmware > that attach the timestamp raw count to the packet meta data when the > same is received from the Packet Accelerator h/w at the ingress. > We need to convert this raw count value to nano second and use a code > like this. > > /* Convert a raw PA timer count to nanoseconds > */ > static inline u64 tstamp_raw_to_ns(struct pa_core_device *core_dev, u32 lo, > u32 hi) > { > u32 mult = core_dev->timestamp_info.mult; > u32 shift = core_dev->timestamp_info.shift; > u64 result; > > /* Minimize overflow errors by doing this in pieces */ > result = ((u64)lo * mult) >> shift; > result += ((u64)hi << (32 - shift)) * mult; > > return result; > } > > The mult, shift values are obtained using the existing clocks_calc_mult_shift() > that will not work, if our driver is built as a dynamically loadable module > as the symbol is not exported. > > Is there an alternative way of doing this without exporting this function. > clocksource_register_hz/khz() can't help in this, right? > John, I didn't see any response? Can I send a patch to export clocks_calc_mult_shift() function?? -- Murali Karicheri Linux Kernel, Keystone ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-30 16:46 ` Murali Karicheri @ 2016-03-30 17:01 ` John Stultz 2016-03-30 17:02 ` John Stultz 0 siblings, 1 reply; 8+ messages in thread From: John Stultz @ 2016-03-30 17:01 UTC (permalink / raw) To: Murali Karicheri; +Cc: lkml, Thomas Gleixner, Kristo, Tero On Wed, Mar 30, 2016 at 9:46 AM, Murali Karicheri <m-karicheri2@ti.com> wrote: > On 03/14/2016 11:27 AM, Murali Karicheri wrote: >> On 03/08/2016 05:25 PM, Murali Karicheri wrote: >>> Hi, >>> >>> I found a patch posted sometime back to export the clocksource >>> function clocks_calc_mult_shift() so that it can be called by >>> drivers that are dynamically loadable. I have not seen any >>> comment against this. Wondering why this is not merged. We require >>> this function exported for use in our driver as well. Can you merge >>> the patch please. Or do you suggest me to repost the same? >>> >>> http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html >>> >>> Thanks >>> >> John, >> >> Some reason, your response didn't make into my inbox. So I am >> reproducing it below. >> >>> Why would the clocksource driver need to calculate the hz/shift value >>> instead of using the clocksource_register_hz/khz functions? >>> >>> thanks >>> -john >> >> John, >> >> In this use case, the timestamp for Tx/Rx is generated by a firmware >> that attach the timestamp raw count to the packet meta data when the >> same is received from the Packet Accelerator h/w at the ingress. >> We need to convert this raw count value to nano second and use a code >> like this. >> >> /* Convert a raw PA timer count to nanoseconds >> */ >> static inline u64 tstamp_raw_to_ns(struct pa_core_device *core_dev, u32 lo, >> u32 hi) >> { >> u32 mult = core_dev->timestamp_info.mult; >> u32 shift = core_dev->timestamp_info.shift; >> u64 result; >> >> /* Minimize overflow errors by doing this in pieces */ >> result = ((u64)lo * mult) >> shift; >> result += ((u64)hi << (32 - shift)) * mult; >> >> return result; >> } >> >> The mult, shift values are obtained using the existing clocks_calc_mult_shift() >> that will not work, if our driver is built as a dynamically loadable module >> as the symbol is not exported. >> >> Is there an alternative way of doing this without exporting this function. >> clocksource_register_hz/khz() can't help in this, right? >> > John, > > I didn't see any response? Can I send a patch to export clocks_calc_mult_shift() function?? Sorry. I was out at a conference when you first sent this out and then I just now got back from vacation. I didn't realize this was for the So I'm still hesitant to export that function because its a bit too raw and I'm not sure drivers should be trusted to handle the inherent tradeoffs it makes (adjustability and accuracy vs counter delta limits to avoid mult overflow) properly without much guidance. Could you instead export a helper function like what clocksource_register_hz/khz() provides? So the timecounter drivers get usable values w/o having to sort out the interval length (as it probably would just be blindly copy-pasted in from somewhere else). thanks -john ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-30 17:01 ` John Stultz @ 2016-03-30 17:02 ` John Stultz 2016-03-31 22:07 ` Murali Karicheri 0 siblings, 1 reply; 8+ messages in thread From: John Stultz @ 2016-03-30 17:02 UTC (permalink / raw) To: Murali Karicheri; +Cc: lkml, Thomas Gleixner, Kristo, Tero On Wed, Mar 30, 2016 at 10:01 AM, John Stultz <john.stultz@linaro.org> wrote: > On Wed, Mar 30, 2016 at 9:46 AM, Murali Karicheri <m-karicheri2@ti.com> wrote: >> I didn't see any response? Can I send a patch to export clocks_calc_mult_shift() function?? > > Sorry. I was out at a conference when you first sent this out and then > I just now got back from vacation. > > I didn't realize this was for the > Heh. Maybe I'm not all the way back from vacation yet. I was going to say.... I didn't realize this was for the timecounter structures. And yes, in that case we don't have a easy helper to calculate the mult/shift pair. thanks -john ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-30 17:02 ` John Stultz @ 2016-03-31 22:07 ` Murali Karicheri 2016-03-31 22:51 ` John Stultz 0 siblings, 1 reply; 8+ messages in thread From: Murali Karicheri @ 2016-03-31 22:07 UTC (permalink / raw) To: John Stultz; +Cc: lkml, Thomas Gleixner, Kristo, Tero On 03/30/2016 01:02 PM, John Stultz wrote: > On Wed, Mar 30, 2016 at 10:01 AM, John Stultz <john.stultz@linaro.org> wrote: >> On Wed, Mar 30, 2016 at 9:46 AM, Murali Karicheri <m-karicheri2@ti.com> wrote: >>> I didn't see any response? Can I send a patch to export clocks_calc_mult_shift() function?? >> >> Sorry. I was out at a conference when you first sent this out and then >> I just now got back from vacation. >> >> I didn't realize this was for the >> > > Heh. Maybe I'm not all the way back from vacation yet. > > I was going to say.... I didn't realize this was for the timecounter > structures. And yes, in that case we don't have a easy helper to > calculate the mult/shift pair. John, So does that mean a green signal for me to send a patch for exporting this? Thanks Murali > > thanks > -john > -- Murali Karicheri Linux Kernel, Keystone ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Export clocks_calc_mult_shift() function 2016-03-31 22:07 ` Murali Karicheri @ 2016-03-31 22:51 ` John Stultz 0 siblings, 0 replies; 8+ messages in thread From: John Stultz @ 2016-03-31 22:51 UTC (permalink / raw) To: Murali Karicheri; +Cc: lkml, Thomas Gleixner, Kristo, Tero On Thu, Mar 31, 2016 at 3:07 PM, Murali Karicheri <m-karicheri2@ti.com> wrote: > On 03/30/2016 01:02 PM, John Stultz wrote: >> On Wed, Mar 30, 2016 at 10:01 AM, John Stultz <john.stultz@linaro.org> wrote: >>> On Wed, Mar 30, 2016 at 9:46 AM, Murali Karicheri <m-karicheri2@ti.com> wrote: >>>> I didn't see any response? Can I send a patch to export clocks_calc_mult_shift() function?? >>> >>> Sorry. I was out at a conference when you first sent this out and then >>> I just now got back from vacation. >>> >>> I didn't realize this was for the >>> >> >> Heh. Maybe I'm not all the way back from vacation yet. >> >> I was going to say.... I didn't realize this was for the timecounter >> structures. And yes, in that case we don't have a easy helper to >> calculate the mult/shift pair. > John, > > So does that mean a green signal for me to send a patch for exporting this? As I said in the previous mail, I'd prefer you export a helper function that avoids having the driver select the interval range, and instead picks a proper value for a given freq. But yea, I understand we need something here. thanks -john ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-31 22:51 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-03-08 22:25 Export clocks_calc_mult_shift() function Murali Karicheri 2016-03-08 22:53 ` John Stultz 2016-03-14 15:27 ` Murali Karicheri 2016-03-30 16:46 ` Murali Karicheri 2016-03-30 17:01 ` John Stultz 2016-03-30 17:02 ` John Stultz 2016-03-31 22:07 ` Murali Karicheri 2016-03-31 22:51 ` John Stultz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).