Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1194986

Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links
Date 2015-07-29 11:20 +0200
Message-ID <pRvGP-3OC-23@gated-at.bofh.it> (permalink)
References <pPvBg-12v-5@gated-at.bofh.it> <pQQtY-2W3-21@gated-at.bofh.it> <pQRJo-4Ft-19@gated-at.bofh.it> <pRoch-1pi-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jul 29, 2015 at 03:38:03AM +0200, Rafael J. Wysocki wrote:
> On Monday, July 27, 2015 08:09:35 PM Viresh Kumar wrote:
> > On 27-07-15, 15:45, Rafael J. Wysocki wrote:
> > > Say the subsys add callback runs for a CPU and it doesn't have a policy.
> > > If it is offline, we ignore it and the add callback won't be executed
> > > for it again.
> > > 
> > > In turn, if it is online, we create a policy for it and we should (right
> > > away) link the policy to all of the CPUs that were offline when the subsys add
> > > callback was called for them.  That's what we do today.
> > > 
> > > Is there anything missing in that?
> > 
> > So the code is working properly after your patch, but I was talking
> > on the lines of what Russell suggested.
> > 
> > We should play with the links only when we receive add-dev/remove-dev
> > from subsys callbacks. The exception to that will be the offline CPUs
> > for which add-dev is called before their policy existed.
> 
> The rule is supposed to be "all of the present CPUs which do not own
> a policy should point to one, unless it doesn't exist".  The right
> approach is then to create links from them to a policy object as soon
> as we create one for them.  Waiting for something else to happen is just
> pointless and this approach covers both the offline and online CPUs, so
> I don't think that changing it would improve things really.

I'm not sure we disagree with that.  It's more about when the symlinks
are created, and when you define that a CPU exists.

If you're attaching to subsystem in sysfs, then the point that the
subsystem interface gets to know about a sysfs node existing is when
it's add_dev method is called - it should not assume that a node exists
prior to that point, otherwise things are racy.

Consider a policy initialisation in parallel with an update of the
CPU present map and adding a CPU to sysfs.  The CPU present map will be
updated first, and then it will be added to sysfs.  If you're initialising
a cpufreq policy in the middle of that and creating symlinks for all
present CPUs, there's a window where the CPU present map indicates that
a CPU is present, but there is no sysfs directory for you to create a
symlink in.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-07-27 15:20 +0200
  Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic  links Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-27 16:40 +0200
    Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-07-29 03:20 +0200
      Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic  links Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-29 07:50 +0200
      Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic  links Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-07-29 11:20 +0200
        Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links "Rafael J. Wysocki" <rafael@kernel.org> - 2015-07-29 16:00 +0200
          Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic  links Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-29 16:30 +0200
            Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic links "Rafael J. Wysocki" <rafael@kernel.org> - 2015-07-29 22:40 +0200
              Re: [PATCH v2] cpufreq: Avoid attempts to create duplicate symbolic  links Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-30 11:10 +0200

csiph-web