sgi-xp: convert BUG_ONs to WARN_ONs... sheesh
PATCH 1/1 sgi-xp: convert BUG_ONs to WARN_ONs... sheesh
While going through the driver wake code, I found the abuse of BUG_ON to be quite disturbing.
Drivers (particularly misc!!!) should not be bringing the kernel to a halt... *sheesh*. Blindly convert them to warnings and let the sgi-xp self-destruct. While WARNs are still abusive, I have no plans on going further than this to cleanup the mess.
--- drivers/misc/sgi-xp/xp_sn2.c | 4 ++-- drivers/misc/sgi-xp/xp_uv.c | 8 ++++---- drivers/misc/sgi-xp/xpc_main.c | 4 ++-- drivers/misc/sgi-xp/xpc_partition.c | 2 +- drivers/misc/sgi-xp/xpc_uv.c | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-)
drivers/misc/sgi-xp/xp_sn2.c +2 -2
@@ -164,7 +164,7 @@ xp_restrict_memprotect_sn2(unsigned long phys_addr, unsigned long size)enum xp_retval xp_init_sn2 (void ) { -BUG_ON (!is_shub ()); +WARN_ON (!is_shub ()); xp_max_npartitions =XP_MAX_NPARTITIONS_SN2 ; xp_partition_id = sn_partition_id;
@@ -183,7 +183,7 @@ xp_init_sn2(void)void xp_exit_sn2 (void ) { -BUG_ON (!is_shub ()); +WARN_ON (!is_shub ());xp_unregister_nofault_code_sn2 (); }
drivers/misc/sgi-xp/xp_uv.c +4 -4
@@ -48,8 +48,8 @@ xp_remote_mmr_read(unsigned long dst_gpa, const unsigned long src_gpa,int ret;unsigned long *dst_va =__va (uv_gpa_to_soc_phys_ram (dst_gpa)); -BUG_ON (!uv_gpa_in_mmr_space (src_gpa)); -BUG_ON (len !=8 ); +WARN_ON (!uv_gpa_in_mmr_space (src_gpa)); +WARN_ON (len !=8 ); ret =gru_read_gpa (dst_va, src_gpa);if (ret ==0 )
@@ -148,7 +148,7 @@ xp_restrict_memprotect_uv(unsigned long phys_addr, unsigned long size)enum xp_retval xp_init_uv (void ) { -BUG_ON (!is_uv ()); +WARN_ON (!is_uv ()); xp_max_npartitions =XP_MAX_NPARTITIONS_UV ; xp_partition_id = sn_partition_id;
@@ -167,5 +167,5 @@ xp_init_uv(void)void xp_exit_uv (void ) { -BUG_ON (!is_uv ()); +WARN_ON (!is_uv ()); }
drivers/misc/sgi-xp/xpc_main.c +2 -2
@@ -796,8 +796,8 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,if (ignore_disconnecting) {if (!atomic_inc_not_zero (&ch->kthreads_assigned)) {/* kthreads assigned had gone to zero */ -BUG_ON (!(ch->flags & -XPC_C_DISCONNECTINGCALLOUT_MADE )); +WARN_ON (!(ch->flags & +XPC_C_DISCONNECTINGCALLOUT_MADE ));break ; }
drivers/misc/sgi-xp/xpc_partition.c +1 -1
@@ -155,7 +155,7 @@ xpc_setup_rsvd_page(void)/* SAL_versions < 3 had a SAL_partid defined as a u8 */ rp->SAL_partid &=0xff ; } -BUG_ON (rp->SAL_partid != xp_partition_id); +WARN_ON (rp->SAL_partid != xp_partition_id);if (rp->SAL_partid <0 || rp->SAL_partid >= xp_max_npartitions) { dev_err(xpc_part, "the reserved page's partid of %d is outside "
drivers/misc/sgi-xp/xpc_uv.c +7 -7
@@ -193,10 +193,10 @@ xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq)#if definedCONFIG_X86_64 ret =uv_bios_mq_watchlist_free (mmr_pnode, mq->watchlist_num); -BUG_ON (ret !=BIOS_STATUS_SUCCESS ); +WARN_ON (ret !=BIOS_STATUS_SUCCESS );#elif definedCONFIG_IA64_GENERIC || definedCONFIG_IA64_SGI_UV ret =sn_mq_watchlist_free (mmr_pnode, mq->watchlist_num); -BUG_ON (ret !=SALRET_OK ); +WARN_ON (ret !=SALRET_OK );#else #error not a supported configuration#endif
@@ -314,7 +314,7 @@ xpc_destroy_gru_mq_uv(struct xpc_gru_mq_uv *mq)/* disallow other partitions to access GRU mq */ mq_size =1UL << mq->order; ret =xp_restrict_memprotect (xp_pa (mq->address), mq_size); -BUG_ON (ret != xpSuccess); +WARN_ON (ret != xpSuccess);/* unregister irq handler and release mq irq/vector mapping */ free_irq (mq->irq,NULL );
@@ -383,7 +383,7 @@ xpc_process_activate_IRQ_rcvd_uv(void)continue ; xpc_activate_IRQ_rcvd--; -BUG_ON (xpc_activate_IRQ_rcvd <0 ); +WARN_ON (xpc_activate_IRQ_rcvd <0 ); act_state_req = part->sn.uv.act_state_req; part->sn.uv.act_state_req =0 ;
@@ -974,7 +974,7 @@ xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head) head->last =NULL ; head->n_entries--; -BUG_ON (head->n_entries <0 ); +WARN_ON (head->n_entries <0 ); first->next =NULL ; }
@@ -1393,7 +1393,7 @@ xpc_handle_notify_mq_ack_uv(struct xpc_channel *ch, msg_slot = &ch->sn.uv.send_msg_slots[entry]; -BUG_ON (msg_slot->msg_slot_number != msg->hdr.msg_slot_number); +WARN_ON (msg_slot->msg_slot_number != msg->hdr.msg_slot_number); msg_slot->msg_slot_number += ch->local_nentries;if (msg_slot->func !=NULL )
@@ -1451,7 +1451,7 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part, msg_slot = ch_uv->recv_msg_slots + (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size; -BUG_ON (msg_slot->hdr.size !=0 ); +WARN_ON (msg_slot->hdr.size !=0 );memcpy (msg_slot, msg, msg->hdr.size);
Signature · 1 line
2.12.0
Quoted 2 lines · Davidlohr Bueso
While going through the driver wake code, I found the abuse of
BUG_ONto be quite disturbing.
These were coded as BUG_ON to ensure they were addressed. They do not get raised in any running environment. Switching to WARN_ON will make it more difficult to determine that a problem has occurred and with a large system, the details of that failure can easily get buried.
Those are my objections. In reality, they are extremely rare and we can easily switch these back to BUG_ON() when we are trying out new releases and live with a WARN_ON() for other instances.
Quoted 1 line
Signed-off-by Davidlohr Bueso <[email protected]>