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


Groups > linux.kernel > #1223323 > unrolled thread

Re: [PATCH] ipvs:Fix locking requirements in the function ip_vs_unlink_service

Started byJulian Anastasov <ja@ssi.bg>
First post2015-09-12 08:30 +0200
Last post2015-09-12 20:40 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] ipvs:Fix locking requirements in the function  ip_vs_unlink_service Julian Anastasov <ja@ssi.bg> - 2015-09-12 08:30 +0200
    Re: [PATCH] ipvs:Fix locking requirements in the function  ip_vs_unlink_service Julian Anastasov <ja@ssi.bg> - 2015-09-12 20:40 +0200

#1223323 — Re: [PATCH] ipvs:Fix locking requirements in the function ip_vs_unlink_service

FromJulian Anastasov <ja@ssi.bg>
Date2015-09-12 08:30 +0200
SubjectRe: [PATCH] ipvs:Fix locking requirements in the function ip_vs_unlink_service
Message-ID<q7MtX-ND-1@gated-at.bofh.it>
	Hello,

On Sat, 12 Sep 2015, Nicholas Krause wrote:

> This fixes locking requirements in the function ip_vs_unlink_service
> to properly use bottom half spinlocking around the call to the function
> __ip_vs_del_service  in order to meet the locking that this paricular
> function requires as stated in it's comments related to locking.

> +	spin_lock_bh(&svc->sched_lock);
>  	__ip_vs_del_service(svc, cleanup);
> +	spin_unlock_bh(&svc->sched_lock);

	BH locking is not needed anymore. Also, sched_lock is
used by schedulers to protect only access to svc->sched_data
fields.

	It seems the comment is outdated after
commit ceec4c381681 ("ipvs: convert services to rcu").

Regards

--
Julian Anastasov <ja@ssi.bg>
--
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/

[toc] | [next] | [standalone]


#1223450

FromJulian Anastasov <ja@ssi.bg>
Date2015-09-12 20:40 +0200
Message-ID<q7XSp-gA-5@gated-at.bofh.it>
In reply to#1223323
	Hello,

On Sat, 12 Sep 2015, nick wrote:

> > 	BH locking is not needed anymore. Also, sched_lock is
> > used by schedulers to protect only access to svc->sched_data
> > fields.
> > 
> > 	It seems the comment is outdated after
> > commit ceec4c381681 ("ipvs: convert services to rcu").
> > 
> Julian,
> You are correct after reading the commit id for rcu locking conversion that this comment
> is outdated. However the locking may still be required but in terms of rcu_read_lock/
> unlock around this function call as it's still a critical region.

	This function is called under __ip_vs_mutex, so
there is single writer that modifies the configuration.
As "readers" the schedulers access the configuration under
rcu_read_lock (eg. called in tcp_conn_schedule) but they
are free to use other locking too. ip_vs_wlc.c scheduler
is example where sched_lock is not used because only
svc->destinations is accessed which is protected with RCU
by definition. You can check __ip_vs_unlink_dest() how
dest is unlinked with list_del_rcu() before sched->del_dest
method is called.

Regards

--
Julian Anastasov <ja@ssi.bg>
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web