[Openais] [PATCH] totemsrp: Remove recv_flush code

Jan Friesse jfriesse at redhat.com
Thu Mar 24 09:15:27 PDT 2011


Reviewed-by: Jan Friesse <jfriesse at redhat.com>

Steven Dake wrote:
> The recv_flush code is no longer necessary because of the miss_count_count
> addition.  It can in some cases lead to register corruption because of
> interactions with -fstack-protector, the recursive nature of how this code
> works, and interactions with the optimizer in some versions of gcc.
> 
> Signed-off-by: Steven Dake <sdake at redhat.com>
> ---
>  exec/totemiba.c  |   10 ----------
>  exec/totemnet.c  |   15 ---------------
>  exec/totemnet.h  |    2 --
>  exec/totemrrp.c  |   54 ------------------------------------------------------
>  exec/totemrrp.h  |    3 ---
>  exec/totemsrp.c  |    2 --
>  exec/totemudp.c  |   30 +-----------------------------
>  exec/totemudpu.c |    7 -------
>  8 files changed, 1 insertions(+), 122 deletions(-)
> 
> diff --git a/exec/totemiba.c b/exec/totemiba.c
> index a0379ff..ec4ccfc 100644
> --- a/exec/totemiba.c
> +++ b/exec/totemiba.c
> @@ -1329,16 +1329,6 @@ int totemiba_processor_count_set (
>  	return (res);
>  }
>  
> -int totemiba_recv_flush (void *iba_context)
> -{
> -	struct totemiba_instance *instance = (struct totemiba_instance *)iba_context;
> -	int res = 0;
> -
> -	instance = NULL;
> -
> -	return (res);
> -}
> -
>  int totemiba_send_flush (void *iba_context)
>  {
>  	struct totemiba_instance *instance = (struct totemiba_instance *)iba_context;
> diff --git a/exec/totemnet.c b/exec/totemnet.c
> index c7670f9..26562ee 100644
> --- a/exec/totemnet.c
> +++ b/exec/totemnet.c
> @@ -87,8 +87,6 @@ struct transport {
>  		const void *msg,
>  		unsigned int msg_len);
>  
> -	int (*recv_flush) (void *transport_context);
> -
>  	int (*send_flush) (void *transport_context);
>  
>  	int (*iface_check) (void *transport_context);
> @@ -131,7 +129,6 @@ struct transport transport_entries[] = {
>  		.token_send = totemudp_token_send,
>  		.mcast_flush_send = totemudp_mcast_flush_send,
>  		.mcast_noflush_send = totemudp_mcast_noflush_send,
> -		.recv_flush = totemudp_recv_flush,
>  		.send_flush = totemudp_send_flush,
>  		.iface_check = totemudp_iface_check,
>  		.finalize = totemudp_finalize,
> @@ -149,7 +146,6 @@ struct transport transport_entries[] = {
>  		.token_send = totemudpu_token_send,
>  		.mcast_flush_send = totemudpu_mcast_flush_send,
>  		.mcast_noflush_send = totemudpu_mcast_noflush_send,
> -		.recv_flush = totemudpu_recv_flush,
>  		.send_flush = totemudpu_send_flush,
>  		.iface_check = totemudpu_iface_check,
>  		.finalize = totemudpu_finalize,
> @@ -170,7 +166,6 @@ struct transport transport_entries[] = {
>  		.token_send = totemiba_token_send,
>  		.mcast_flush_send = totemiba_mcast_flush_send,
>  		.mcast_noflush_send = totemiba_mcast_noflush_send,
> -		.recv_flush = totemiba_recv_flush,
>  		.send_flush = totemiba_send_flush,
>  		.iface_check = totemiba_iface_check,
>  		.finalize = totemiba_finalize,
> @@ -307,16 +302,6 @@ int totemnet_processor_count_set (
>  	return (res);
>  }
>  
> -int totemnet_recv_flush (void *net_context)
> -{
> -	struct totemnet_instance *instance = (struct totemnet_instance *)net_context;
> -	int res = 0;
> -
> -	res = instance->transport->recv_flush (instance->transport_context);
> -
> -	return (res);
> -}
> -
>  int totemnet_send_flush (void *net_context)
>  {
>  	struct totemnet_instance *instance = (struct totemnet_instance *)net_context;
> diff --git a/exec/totemnet.h b/exec/totemnet.h
> index 7e6374c..a0a51eb 100644
> --- a/exec/totemnet.h
> +++ b/exec/totemnet.h
> @@ -88,8 +88,6 @@ extern int totemnet_mcast_noflush_send (
>  	const void *msg,
>  	unsigned int msg_len);
>  
> -extern int totemnet_recv_flush (void *net_context);
> -
>  extern int totemnet_send_flush (void *net_context);
>  
>  extern int totemnet_iface_check (void *net_context);
> diff --git a/exec/totemrrp.c b/exec/totemrrp.c
> index a8ebd08..5a9b7b3 100644
> --- a/exec/totemrrp.c
> +++ b/exec/totemrrp.c
> @@ -143,9 +143,6 @@ struct rrp_algo {
>  		const void *msg,
>  		unsigned int msg_len);
>  
> -	void (*recv_flush) (
> -		struct totemrrp_instance *instance);
> -
>  	void (*send_flush) (
>  		struct totemrrp_instance *instance);
>  
> @@ -276,9 +273,6 @@ static void none_token_send (
>  	const void *msg,
>  	unsigned int msg_len);
>  
> -static void none_recv_flush (
> -	struct totemrrp_instance *instance);
> -
>  static void none_send_flush (
>  	struct totemrrp_instance *instance);
>  
> @@ -346,9 +340,6 @@ static void passive_token_send (
>  	const void *msg,
>  	unsigned int msg_len);
>  
> -static void passive_recv_flush (
> -	struct totemrrp_instance *instance);
> -
>  static void passive_send_flush (
>  	struct totemrrp_instance *instance);
>  
> @@ -416,9 +407,6 @@ static void active_token_send (
>  	const void *msg,
>  	unsigned int msg_len);
>  
> -static void active_recv_flush (
> -	struct totemrrp_instance *instance);
> -
>  static void active_send_flush (
>  	struct totemrrp_instance *instance);
>  
> @@ -470,7 +458,6 @@ struct rrp_algo none_algo = {
>  	.mcast_flush_send	= none_mcast_flush_send,
>  	.token_recv		= none_token_recv,
>  	.token_send		= none_token_send,
> -	.recv_flush		= none_recv_flush,
>  	.send_flush		= none_send_flush,
>  	.iface_check		= none_iface_check,
>  	.processor_count_set	= none_processor_count_set,
> @@ -489,7 +476,6 @@ struct rrp_algo passive_algo = {
>  	.mcast_flush_send	= passive_mcast_flush_send,
>  	.token_recv		= passive_token_recv,
>  	.token_send		= passive_token_send,
> -	.recv_flush		= passive_recv_flush,
>  	.send_flush		= passive_send_flush,
>  	.iface_check		= passive_iface_check,
>  	.processor_count_set	= passive_processor_count_set,
> @@ -508,7 +494,6 @@ struct rrp_algo active_algo = {
>  	.mcast_flush_send	= active_mcast_flush_send,
>  	.token_recv		= active_token_recv,
>  	.token_send		= active_token_send,
> -	.recv_flush		= active_recv_flush,
>  	.send_flush		= active_send_flush,
>  	.iface_check		= active_iface_check,
>  	.processor_count_set	= active_processor_count_set,
> @@ -594,11 +579,6 @@ static void none_token_send (
>  		msg, msg_len);
>  }
>  
> -static void none_recv_flush (struct totemrrp_instance *instance)
> -{
> -	totemnet_recv_flush (instance->net_handles[0]);
> -}
> -
>  static void none_send_flush (struct totemrrp_instance *instance)
>  {
>  	totemnet_send_flush (instance->net_handles[0]);
> @@ -930,19 +910,6 @@ static void passive_token_send (
>  
>  }
>  
> -static void passive_recv_flush (struct totemrrp_instance *instance)
> -{
> -	struct passive_instance *rrp_algo_instance = (struct passive_instance *)instance->rrp_algo_instance;
> -	unsigned int i;
> -
> -	for (i = 0; i < instance->interface_count; i++) {
> -		if (rrp_algo_instance->faulty[i] == 0) {
> -
> -			totemnet_recv_flush (instance->net_handles[i]);
> -		}
> -	}
> -}
> -
>  static void passive_send_flush (struct totemrrp_instance *instance)
>  {
>  	struct passive_instance *rrp_algo_instance = (struct passive_instance *)instance->rrp_algo_instance;
> @@ -1325,19 +1292,6 @@ static void active_token_send (
>  	}
>  }
>  
> -static void active_recv_flush (struct totemrrp_instance *instance)
> -{
> -	struct active_instance *rrp_algo_instance = (struct active_instance *)instance->rrp_algo_instance;
> -	unsigned int i;
> -
> -	for (i = 0; i < instance->interface_count; i++) {
> -		if (rrp_algo_instance->faulty[i] == 0) {
> -
> -			totemnet_recv_flush (instance->net_handles[i]);
> -		}
> -	}
> -}
> -
>  static void active_send_flush (struct totemrrp_instance *instance)
>  {
>  	struct active_instance *rrp_algo_instance = (struct active_instance *)instance->rrp_algo_instance;
> @@ -1687,14 +1641,6 @@ int totemrrp_token_target_set (
>  
>  	return (0);
>  }
> -int totemrrp_recv_flush (void *rrp_context)
> -{
> -	struct totemrrp_instance *instance = (struct totemrrp_instance *)rrp_context;
> -
> -	instance->rrp_algo->recv_flush (instance);
> -
> -	return (0);
> -}
>  
>  int totemrrp_send_flush (void *rrp_context)
>  {
> diff --git a/exec/totemrrp.h b/exec/totemrrp.h
> index da79ed2..6a70527 100644
> --- a/exec/totemrrp.h
> +++ b/exec/totemrrp.h
> @@ -98,9 +98,6 @@ extern int totemrrp_mcast_flush_send (
>  	const void *msg,
>  	unsigned int msg_len);
>  
> -extern int totemrrp_recv_flush (
> -	void *rrp_context);
> -
>  extern int totemrrp_send_flush (
>  	void *rrp_context);
>  
> diff --git a/exec/totemsrp.c b/exec/totemsrp.c
> index 045fd5c..88a8f0f 100644
> --- a/exec/totemsrp.c
> +++ b/exec/totemsrp.c
> @@ -3418,8 +3418,6 @@ static int message_handler_orf_token (
>  	}
>  #endif
>  
> -	totemrrp_recv_flush (instance->totemrrp_context);
> -
>  	/*
>  	 * Determine if we should hold (in reality drop) the token
>  	 */
> diff --git a/exec/totemudp.c b/exec/totemudp.c
> index b96bdbd..977e754 100644
> --- a/exec/totemudp.c
> +++ b/exec/totemudp.c
> @@ -1178,11 +1178,7 @@ static int net_deliver_fn (
>  	unsigned char *msg_offset;
>  	unsigned int size_delv;
>  
> -	if (instance->flushing == 1) {
> -		iovec = &instance->totemudp_iov_recv_flush;
> -	} else {
> -		iovec = &instance->totemudp_iov_recv;
> -	}
> +	iovec = &instance->totemudp_iov_recv;
>  
>  	/*
>  	 * Receive datagram
> @@ -1853,30 +1849,6 @@ int totemudp_processor_count_set (
>  	return (res);
>  }
>  
> -int totemudp_recv_flush (void *udp_context)
> -{
> -	struct totemudp_instance *instance = (struct totemudp_instance *)udp_context;
> -	struct pollfd ufd;
> -	int nfds;
> -	int res = 0;
> -
> -	instance->flushing = 1;
> -
> -	do {
> -		ufd.fd = instance->totemudp_sockets.mcast_recv;
> -		ufd.events = POLLIN;
> -		nfds = poll (&ufd, 1, 0);
> -		if (nfds == 1 && ufd.revents & POLLIN) {
> -		net_deliver_fn (0, instance->totemudp_sockets.mcast_recv,
> -			ufd.revents, instance);
> -		}
> -	} while (nfds == 1);
> -
> -	instance->flushing = 0;
> -
> -	return (res);
> -}
> -
>  int totemudp_send_flush (void *udp_context)
>  {
>  	struct totemudp_instance *instance = (struct totemudp_instance *)udp_context;
> diff --git a/exec/totemudpu.c b/exec/totemudpu.c
> index 2db33ad..e4ea431 100644
> --- a/exec/totemudpu.c
> +++ b/exec/totemudpu.c
> @@ -1498,13 +1498,6 @@ int totemudpu_processor_count_set (
>  	return (res);
>  }
>  
> -int totemudpu_recv_flush (void *udpu_context)
> -{
> -	int res = 0;
> -
> -	return (res);
> -}
> -
>  int totemudpu_send_flush (void *udpu_context)
>  {
>  	int res = 0;



More information about the Openais mailing list