Thanks Paul, I've done the revert and merged the 5.2 -stable updates.
Bruce On Mon, Jul 20, 2020 at 8:01 PM Paul Gortmaker <[email protected]> wrote: > > This reverts commit 65bc42b66d0c55b0fec8f5e142e9f7df1166c3a7. > > In mainline, commit 11d6011c2cf2 ("net: core: device_rename: Use rwsem > instead of a seqcount") appeared in v5.8-rc1, as an rt-friendly patch. > > If we look in the upstream linux-rt-devel repository, we see that in > deploying it in v5.6-rt, as fast forward commit 1984aa963358, we see it > 1st appeared as part of a 24 commit series in v5.6.17-rt10: > > commit 11bf6eb48f4db2117b9eb4875245a68c0340ca92 (tag: v5.6.17-rt10-patches) > Author: Sebastian Andrzej Siewior <[email protected]> > Date: Tue Jun 16 14:30:28 2020 +0200 > > [ANNOUNCE] v5.6.17-rt10 > > Dear RT folks! > > I'm pleased to announce the v5.6.17-rt10 patch set. > > Changes since v5.6.17-rt9: > > - Add the seqcount series by Ahmed S. Darwish. > The series annotates the lock protecting the struct seqcount > against > multiple writer. In RT the lock annotation can be utilized to block > on in case the writer is active. This is the same technique that is > used now but we can avoid replacing the seqcount with a seqlock and > have code that is closer to mainline. > > In preparation, we see in the fast-forward, commit 3115f1749777 ("Revert > seqcount related patches") which is a bulk revert of about 12 earlier > preempt-rt commits, including a revert of commit 969f7336673c ("net: Add > a mutex around devnet_rename_seq") > > The v5.2.49 kernel also contains a backport of 11d6011c2cf2, and so we'll > run into a merge conflict as the two -rt devnet_rename solutions overlap. > > So prior to merging v5.2.49 to v5.2-rt, we revert the older -rt solution > in order to make way for the newer one from the v5.2.49 kernel, just as > we see in the above v5.6-rt version. > > Signed-off-by: Paul Gortmaker <[email protected]> > > diff --git a/net/core/dev.c b/net/core/dev.c > index 5ee21cbc121c..c575695e3428 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -195,7 +195,6 @@ static unsigned int napi_gen_id = NR_CPUS; > static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8); > > static seqcount_t devnet_rename_seq; > -static DEFINE_MUTEX(devnet_rename_mutex); > > static inline void dev_base_seq_inc(struct net *net) > { > @@ -921,8 +920,7 @@ int netdev_get_name(struct net *net, char *name, int > ifindex) > strcpy(name, dev->name); > rcu_read_unlock(); > if (read_seqcount_retry(&devnet_rename_seq, seq)) { > - mutex_lock(&devnet_rename_mutex); > - mutex_unlock(&devnet_rename_mutex); > + cond_resched(); > goto retry; > } > > @@ -1199,17 +1197,20 @@ int dev_change_name(struct net_device *dev, const > char *newname) > likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK))) > return -EBUSY; > > - mutex_lock(&devnet_rename_mutex); > - __raw_write_seqcount_begin(&devnet_rename_seq); > + write_seqcount_begin(&devnet_rename_seq); > > - if (strncmp(newname, dev->name, IFNAMSIZ) == 0) > - goto outunlock; > + if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { > + write_seqcount_end(&devnet_rename_seq); > + return 0; > + } > > memcpy(oldname, dev->name, IFNAMSIZ); > > err = dev_get_valid_name(net, dev, newname); > - if (err < 0) > - goto outunlock; > + if (err < 0) { > + write_seqcount_end(&devnet_rename_seq); > + return err; > + } > > if (oldname[0] && !strchr(oldname, '%')) > netdev_info(dev, "renamed from %s\n", oldname); > @@ -1222,12 +1223,11 @@ int dev_change_name(struct net_device *dev, const > char *newname) > if (ret) { > memcpy(dev->name, oldname, IFNAMSIZ); > dev->name_assign_type = old_assign_type; > - err = ret; > - goto outunlock; > + write_seqcount_end(&devnet_rename_seq); > + return ret; > } > > - __raw_write_seqcount_end(&devnet_rename_seq); > - mutex_unlock(&devnet_rename_mutex); > + write_seqcount_end(&devnet_rename_seq); > > netdev_adjacent_rename_links(dev, oldname); > > @@ -1248,8 +1248,7 @@ int dev_change_name(struct net_device *dev, const char > *newname) > /* err >= 0 after dev_alloc_name() or stores the first errno > */ > if (err >= 0) { > err = ret; > - mutex_lock(&devnet_rename_mutex); > - __raw_write_seqcount_begin(&devnet_rename_seq); > + write_seqcount_begin(&devnet_rename_seq); > memcpy(dev->name, oldname, IFNAMSIZ); > memcpy(oldname, newname, IFNAMSIZ); > dev->name_assign_type = old_assign_type; > @@ -1262,11 +1261,6 @@ int dev_change_name(struct net_device *dev, const char > *newname) > } > > return err; > - > -outunlock: > - __raw_write_seqcount_end(&devnet_rename_seq); > - mutex_unlock(&devnet_rename_mutex); > - return err; > } > > /** > -- > 2.27.0 > -- - Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8847): https://lists.yoctoproject.org/g/linux-yocto/message/8847 Mute This Topic: https://lists.yoctoproject.org/mt/75694540/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
