WASHINGTON (AP) — China’s growing frustration with longtime ally North Korea offers the United States a glimmer of hope about a once unthinkable prospect: holding discussions between Washington and Beijing about what to do if the government in Pyongyang collapses.

There is no sign that the North Korean regime is in danger or that U.S. President Barack Obama and Chinese President Xi Jinping will discuss that possibility when they meet this week in California. Any such talk would alarm North Korea if word got out.

But in China, talk of a North Korean collapse is no longer the taboo subject it once was. Academics are increasingly willing to discuss it and a former top U.S. admiral said he has detected, during informal meetings, a willingness of Chinese officials to consider such discussions.

That reflects internal debate in China and dismay about North Korean brinkmanship in the aftermath of rocket and nuclear tests this winter that defied China, which supplies the North with crucial food, energy and diplomatic support.

Young North Korean leader Kim Jong Un appears to have consolidated control since taking power a year-and-a-half ago, and the spike in tension that followed its February nuclear test has eased in recent weeks. But there’s a perennial threat of fighting with South Korea on one of the world’s most militarized frontiers. China would want to avoid any conflict that could draw in its forces from the North, and U.S. forces from South Korea, as during the 1950-53 Korean War. Both powers would be concerned about the fate of North Korea’s arsenal of chemical weapons, missiles and nuclear weapons and facilities.

But China also has reason to fear a North Korean collapse. That could trigger an exodus of hungry refugees across its border and lead to a reunified Korea allied with the United States, hosting American troops on China’s doorstep.

Analysts say that until Chinese leaders decide among themselves what kind of outcome they are prepared to accept on the Korean Peninsula, they won’t discuss the subject with U.S. officials. Still, they see some changes in China’s attitude.

William Fallon, a former chief of U.S. Pacific Command, said the U.S. and China would have a shared interest in working together on North Korea and discussing issues such as securing its nuclear weapons. He said that in unofficial meetings in China this year with former and current Chinese government and military officials, he raised that possibility in broad terms and detected a willingness to consider it.

“I certainly suggested, and I know others have officially and formally suggested that it’s about time we sat down to talk because we have common interest here,” Fallon said. “I think that idea is not being rejected. The heads are nodding and they are considering it. I would expect that this would move forward, carefully.”

Such cooperation would require Beijing and Washington overcoming deep, mutual suspicions that characterize their relations as China’s economic and military power grows and the U.S. looks to boost its profile and long-established presence in Asia.

But China is taking a tougher stance on North Korea, as the U.S. hoped it would. It has supported tighter U.N. sanctions in response to the February nuclear test and stepped up border inspections. Most notably, a leading Chinese state bank shut accounts of North Korea’s Foreign Trade Bank, its main foreign exchange institution.

Two weeks ago, China hosted a top North Korean envoy, a visit that Brookings Institution scholar Cheng Li says was expedited in advance of the U.S.-China summit that starts Friday. The North has since adopted a less confrontational stance and declared a willingness to return to the negotiating table.

But the U.S. sees that as little progress by North Korea, noting that the day after Vice Marshal Choe Ryong returned home, Pyongyang repudiated the goal of denuclearization — a U.S. prerequisite for restarting long-stalled aid-for-disarmament negotiations.

While China is speaking out more against the North’s nuclear ambitions, it is not taking steps that could hasten the end of the Kim regime, such as cutting supplies.

“Any chaos or armed conflict on the Korean Peninsula would have a major impact on China’s national security interests. We have to keep that in mind all the time,” China’s ambassador to the U.S., Cui Tiankai, told Foreign Policy magazine.

While the more critical recent tone of Chinese scholars — and their willingness to discuss once-forbidden issues like reunification — is probably not the position of China’s leaders, it reflects the government’s frustrations with North Korea and could be intended to send a message for it not to push China too far, said former senior State Department official Evans Revere.

China’s own strategic interests have been affected by Pyongyang’s recent threats of pre-emptive nuclear strikes against the U.S. and its allies. The U.S. scaled up military exercises with South Korea — staging flights of nuclear-capable B-52 and B-2 bombers — and boosting its missile defenses in China’s backyard.

“The new Chinese leadership has been alarmed by how quickly North Korea destabilized the entire region with its threats,” said John Park, a Northeast Asia expert at the Massachusetts Institute of Technology. “It’s presented them with a strategic dilemma.”

At unofficial talks on Northeast Asian security held in Germany last week, government-linked Chinese academics signaled that Beijing’s long-held interest in maintaining stability at all costs in North Korea is shifting, and it is putting increasing emphasis on denuclearization, said Frank Jannuzi of Amnesty International USA, who attended the conference.

Yet the prospects for diplomacy remain bleak, if Pyongyang demands to be treated as a nuclear power, and Washington insists on concrete signs of the North’s willingness to disarm before international negotiations can restart.

“China feels they’ve done their part by convincing North Korea to return to dialogue and now it’s up to the U.S. and South Korea to do their part and welcome them back,” said Jannuzi, a former Asia policy adviser to then Sen. John Kerry, now Washington’s top diplomat. “They feel like the ball is in our court.”